驴友花雕 发表于 2021-9-9 18:00:47

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之三:8x8 LED 矩阵测试,显示“T”

实验开源代码

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之三:8x8 LED 矩阵测试,显示“T”
实验接线:
VK16k33    UNO
VIN      5V
GND      GND
SCL      A5
SDA      A4
*/

// For I2C
#include <Wire.h>
// Libraries for Matrix
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() {
Serial.begin(9600);
// Good idea to send data to both
// device and serial as it helps with
// troubleshooting.
Serial.println("8x8 LED 矩阵测试");
// set the address
matrix.begin(0x70);
}

void loop() {
// Make sure where led 0x0 is:
// And it is working
matrix.setTextSize(1);
matrix.setTextColor(LED_ON);
// clear the matrix
matrix.clear();
// position the cursor
matrix.setCursor(2, 0);
// text to print
matrix.print("T");
Serial.println("显示‘T’");
// write the data out to the matrix
matrix.writeDisplay();
// how fast the characters are displayed
delay(1000);
}

驴友花雕 发表于 2021-9-9 18:02:18

实验串口返回情况


驴友花雕 发表于 2021-9-9 18:04:10

实验场景图


驴友花雕 发表于 2021-9-9 18:32:57

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之四:8x8 LED 矩阵测试,显示一斜线

实验开源代码

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之四:8x8 LED 矩阵测试,显示一斜线
实验接线:
VK16k33    UNO
VIN      5V
GND      GND
SCL      A5
SDA      A4
*/

// For I2C
#include <Wire.h>
// Libraries for Matrix
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() {
Serial.begin(9600);
// Good idea to send data to both
// device and serial as it helps with
// troubleshooting.
Serial.println("8x8 LED 矩阵测试");
// set the address
matrix.begin(0x70);
}

void loop() {         
// clear display      
matrix.clear();      
// set (start pixel x,y end pixel, ON)            
matrix.drawLine(1,0, 8,7, LED_ON);      
// write RAM to matrix      
matrix.writeDisplay();      
delay(500);      
}      

驴友花雕 发表于 2021-9-9 18:34:24

实验场景图


驴友花雕 发表于 2021-9-9 21:00:12

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之五:8x8 LED 矩阵测试,显示正方形

实验开源代码

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之五:8x8 LED 矩阵测试,显示正方形
实验接线:
VK16k33    UNO
VIN      5V
GND      GND
SCL      A5
SDA      A4
*/

// For I2C
#include <Wire.h>
// Libraries for Matrix
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() {
Serial.begin(9600);
// Good idea to send data to both
// device and serial as it helps with
// troubleshooting.
Serial.println("8x8 LED 矩阵测试");
// set the address
matrix.begin(0x70);
}

void loop() {         
// clear display      
matrix.clear();      
// draw a retangle around the outer edge      
// of the display      
matrix.drawRect(1,0, 7,8, LED_ON);      
// uncomment below      
// will draw a rectangle arond the edge and      
// fill it in, ie. turn on all of the LEDs      
//matrix.fillRect(0,0, 8,8, LED_ON);      
// write the changes to the display      
matrix.writeDisplay();         
delay(500);      
}      

驴友花雕 发表于 2021-9-9 21:07:25

实验场景图


驴友花雕 发表于 2021-9-10 07:13:10

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之六:滚动的一串字母

实验开源代码

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之六:滚动的一串字母
实验接线:
VK16k33    UNO
VIN      5V
GND      GND
SCL      A5
SDA      A4
*/

#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() {
Serial.begin(9600);
Serial.println("8x8 LED Matrix Test");

// pass in the address
matrix.begin(0x70);
}

void loop() {
// scroll some text across the matrix
matrix.setTextSize(1);
// Set wrap to false for smooth scrollling
matrix.setTextWrap(false);
matrix.setTextColor(LED_ON);
for (int8_t x = 0; x >= -36; x--) {
    matrix.clear();
    matrix.setCursor(x, 0);
    matrix.print("WoW MoM");
    matrix.writeDisplay();
    delay(100);
}
}

驴友花雕 发表于 2021-9-10 07:29:32

实验场景图动态图

驴友花雕 发表于 2021-9-10 07:48:13

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之七:流动的斜线

实验开源代码

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之七:流动的斜线
实验接线:
VK16k33    UNO
VIN      5V
GND      GND
SCL      A5
SDA      A4
*/

#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
#ifndef _BV
#define _BV(bit) (1<<(bit))
#endif
Adafruit_LEDBackpack matrix = Adafruit_LEDBackpack();
uint8_t counter = 0;
void setup() {
Serial.begin(9600);
Serial.println("VK16K33 test");
matrix.begin(0x70);// pass in the address
}
void loop() {
// paint one LED per row. The HT16K33 internal memory looks like
// a 8x16 bit matrix (8 rows, 16 columns)
for (uint8_t i=0; i<8; i++) {
// draw a diagonal row of pixels

    matrix.displaybuffer = _BV((counter+i) % 16) | _BV((counter+i+8) % 16);
}
// write the changes we just made to the display
matrix.writeDisplay();
delay(100);
counter++;
if (counter >= 16) counter = 0;
}

驴友花雕 发表于 2021-9-10 08:34:51

本帖最后由 驴友花雕 于 2021-9-10 08:37 编辑

实验场景图动态图



驴友花雕 发表于 2021-9-10 10:51:02

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之八:右向流动显示“SOS Call 9-1-1”

实验开源代码

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之八:右向流动显示“SOS Call 9-1-1”
实验接线:
VK16k33    UNO
VIN      5V
GND      GND
SCL      A5
SDA      A4
*/

#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"   //necessary

Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() {
   
matrix.begin(0x70);// pass in the address
}

static const uint8_t PROGMEM    // Setting Static Constants for the LED Matrix
S_bmp[] =                  // Declaring the "S" Shape Bitmap for the Matrix
{ B01111111,                // String of characters dictates each LED position as on or off on 8x8 gird
    B01111111,               // 0 = Off LED 1 = On LED
    B01100000,
    B01111110,
    B01111110,
    B00000110,
    B11111110,
    B11111110 },
   
O_bmp[] =               // Declaring the "O" Shape Bitmap for the Matrix
{ B11111111,
    B11111111,
    B11000011,
    B11000011,
    B11000011,
    B11000011,
    B11111111,
    B11111111 },
   
S2_bmp[] =          // Declaring the second "S" Shape Bitmap for the Matrix

{ B01111111,
    B01111111,
    B01110000,
    B01111110,
    B01111110,
    B00000110,
    B11111110,
    B11111110 };

void loop() {
matrix.clear();                                     // Starting with clear matrix where all LEDs are off
matrix.drawBitmap(1, 0, S_bmp, 8, 8, LED_ON);      // Drawing the "S" Bitmap according to void setup configuration
matrix.writeDisplay();                            // With 2000 milisecond delay
delay(2000);

matrix.clear();                                    // Transitioning with clear matrix where all LEDs are off
matrix.drawBitmap(1, 0, O_bmp, 7, 8, LED_ON);   // Drawing the "O" Bitmap according to void setup configuration
matrix.writeDisplay();                           // With 2000 milisecond delay
delay(2000);

matrix.clear();                                    // Transitioning with clear matrix where all LEDs are off
matrix.drawBitmap(1, 0, S2_bmp, 7, 8, LED_ON);    // Drawing the second "S" Bitmap according to void setup configuration
matrix.writeDisplay();                           // With 2000 milisecond delay
delay(2000);


matrix.setTextSize(1);                        // Setting matrix text size to 1
matrix.setTextWrap(false);                     // Preventing text wrapping to scroll text continuously through matrix
matrix.setTextColor(LED_ON);                  // Turning LED On
for (int8_t x=0; x>=-36; x--) {            // Setting for loop to position letters side by side for the scroll
    matrix.clear();                           // Transitioning with clear matrix where all LEDs are off
    matrix.setCursor(x,0);                   // Defining letter positions to print one at time side by side
    matrix.print(" Call");                   // Printing "Call" on the matrix
    matrix.writeDisplay();               // With 100 milisecond delay
    delay(100);
}
matrix.setRotation(0);                  // Prevent rotation and keep scroll at the same angle
for (int8_t x=7; x>=-36; x--) {      // Setting new for loop to position letters side by side for the scroll
    matrix.clear();                     // Transitioning with clear matrix where all LEDs are off
    matrix.setCursor(x,0);             // Defining letter positions to print one at time side by side
    matrix.print("9-1-1");            // Printing "9-1-1" on the matrix
    matrix.writeDisplay();         // With 100 milisecond delay
    delay(100);
}
}

驴友花雕 发表于 2021-9-10 11:12:42

实验场景图动态图



驴友花雕 发表于 2021-9-10 11:49:56

刚搜到的模块电原理参考图与实验图



驴友花雕 发表于 2021-9-10 11:51:13


驴友花雕 发表于 2021-9-10 13:18:11

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之九:循环显示垂直条

实验开源代码

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之九:循环显示垂直条
实验接线:
VK16k33    UNO
VIN      5V
GND      GND
SCL      A5
SDA      A4
*/

#include <Wire.h>
#include "Grove_LED_Matrix_Driver_HT16K33.h"

Matrix_8x8 matrix;

void setup() {
Wire.begin();
matrix.init();
matrix.setBrightness(0);
matrix.setBlinkRate(BLINK_OFF);
}

void loop() {
for (int i = 0; i < 33; i++) {
    // writeBar的输入范围是
    matrix.writeBar(i);
    matrix.display();
    delay(150);
}
}

驴友花雕 发表于 2021-9-10 13:27:05

实验场景图动态图

驴友花雕 发表于 2021-9-10 16:13:50

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之十:显示12个自定义图片

实验开源代码

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目之十:显示12个自定义图片
实验接线:
VK16k33    UNO
VIN      5V
GND      GND
SCL      A5
SDA      A4
*/

#include <Wire.h>
#include "Grove_LED_Matrix_Driver_HT16K33.h"


// 创建 uint64_t 类型的 8x8 矩阵图片在如下网址
// https://xantorohara.github.io/led-matrix-editor/#
const uint64_t EXAMPLE = {
    0x5554545050404000,
    0x3f21212121212121,
    0x3f212d2121212121,
    0x3f212d212d212121,
    0x3f212d212d212d21,
    0x3f212d2d2d212121,
    0x3f212d2d2d2d2d2d,
    0x00040a1120408000,
    0x081c3e7f1c1c1c1c,
    0x0010307fff7f3010,
    0x1c1c1c1c7f3e1c08,
    0x00080cfefffe0c08
};

Matrix_8x8 matrix;

void setup() {
    Wire.begin();
    matrix.init();
    matrix.setBrightness(0);
    matrix.setBlinkRate(BLINK_OFF);
}

void loop() {
    matrix.writeOnePicture(EXAMPLE);
    matrix.display();
    delay(500);

    matrix.writePictures(EXAMPLE, 12, 1000, ACTION_SCROLLING);
    matrix.display();
}

驴友花雕 发表于 2021-9-10 16:39:10

本帖最后由 驴友花雕 于 2021-9-11 07:47 编辑

实验场景图动态图



驴友花雕 发表于 2021-9-10 16:41:06

实验场景图动态图之二

驴友花雕 发表于 2021-9-11 07:47:00

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目十一:滚动的小球

实验开源代码

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目十一:滚动的小球
实验接线:
VK16k33    UNO
VIN      5V
GND      GND
SCL      A5
SDA      A4
*/

#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_24bargraph bar = Adafruit_24bargraph();

void setup() {
Serial.begin(9600);
Serial.println("HT16K33 Bi-Color Bargraph test");

bar.begin(0x70);// pass in the address

for (uint8_t b=0; b<24; b++ ){
    if ((b % 3) == 0)bar.setBar(b, LED_RED);
    if ((b % 3) == 1)bar.setBar(b, LED_YELLOW);
    if ((b % 3) == 2)bar.setBar(b, LED_GREEN);
}
bar.writeDisplay();
delay(2000);
}

void loop() {
for (uint8_t b=0; b<24; b++) {
   bar.setBar(b, LED_RED);
   bar.writeDisplay();
   delay(50);
   bar.setBar(b, LED_OFF);
   bar.writeDisplay();
}
for (uint8_t b=0; b<24; b++) {
   bar.setBar(b, LED_GREEN);
   bar.writeDisplay();
   delay(50);
   bar.setBar(b, LED_OFF);
   bar.writeDisplay();
}

for (uint8_t b=0; b<24; b++) {
   bar.setBar(36-b, LED_YELLOW);
   bar.writeDisplay();
   delay(50);
   bar.setBar(42-b, LED_OFF);
   bar.writeDisplay();
}
}

页: 1 [2] 3
查看完整版本: 【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C