28801浏览
楼主: 驴友花雕

[项目] 【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C

[复制链接]

驴友花雕  中级技神
 楼主|

发表于 2021-9-9 18:00:47

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

  实验开源代码

  1. /*
  2.   【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  3.   实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  4.   项目之三:8x8 LED 矩阵测试,显示“T”
  5.   实验接线:
  6.   VK16k33    UNO
  7.   VIN        5V
  8.   GND        GND
  9.   SCL        A5
  10.   SDA        A4
  11. */
  12. // For I2C
  13. #include <Wire.h>
  14. // Libraries for Matrix
  15. #include "Adafruit_LEDBackpack.h"
  16. #include "Adafruit_GFX.h"
  17. Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
  18. void setup() {
  19.   Serial.begin(9600);
  20.   // Good idea to send data to both
  21.   // device and serial as it helps with
  22.   // troubleshooting.
  23.   Serial.println("8x8 LED 矩阵测试");
  24.   // set the address
  25.   matrix.begin(0x70);
  26. }
  27. void loop() {
  28.   // Make sure where led 0x0 is:
  29.   // And it is working
  30.   matrix.setTextSize(1);
  31.   matrix.setTextColor(LED_ON);
  32.   // clear the matrix
  33.   matrix.clear();
  34.   // position the cursor
  35.   matrix.setCursor(2, 0);
  36.   // text to print
  37.   matrix.print("T");
  38.   Serial.println("显示‘T’");
  39.   // write the data out to the matrix
  40.   matrix.writeDisplay();
  41.   // how fast the characters are displayed
  42.   delay(1000);
  43. }
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-9 18:02:18

实验串口返回情况

【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-9 18:04:10

实验场景图

【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-9 18:32:57

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

  实验开源代码

  1. /*
  2.   【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  3.   实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  4.   项目之四:8x8 LED 矩阵测试,显示一斜线
  5.   实验接线:
  6.   VK16k33    UNO
  7.   VIN        5V
  8.   GND        GND
  9.   SCL        A5
  10.   SDA        A4
  11. */
  12. // For I2C
  13. #include <Wire.h>
  14. // Libraries for Matrix
  15. #include "Adafruit_LEDBackpack.h"
  16. #include "Adafruit_GFX.h"
  17. Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
  18. void setup() {
  19.   Serial.begin(9600);
  20.   // Good idea to send data to both
  21.   // device and serial as it helps with
  22.   // troubleshooting.
  23.   Serial.println("8x8 LED 矩阵测试");
  24.   // set the address
  25.   matrix.begin(0x70);
  26. }
  27. void loop() {         
  28. // clear display        
  29. matrix.clear();        
  30. // set (start pixel x,y end pixel, ON)            
  31. matrix.drawLine(1,0, 8,7, LED_ON);      
  32. // write RAM to matrix        
  33. matrix.writeDisplay();      
  34. delay(500);      
  35. }      
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-9 18:34:24

实验场景图

【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-9 21:00:12

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

  实验开源代码

  1. /*
  2.   【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  3.   实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  4.   项目之五:8x8 LED 矩阵测试,显示正方形
  5.   实验接线:
  6.   VK16k33    UNO
  7.   VIN        5V
  8.   GND        GND
  9.   SCL        A5
  10.   SDA        A4
  11. */
  12. // For I2C
  13. #include <Wire.h>
  14. // Libraries for Matrix
  15. #include "Adafruit_LEDBackpack.h"
  16. #include "Adafruit_GFX.h"
  17. Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
  18. void setup() {
  19.   Serial.begin(9600);
  20.   // Good idea to send data to both
  21.   // device and serial as it helps with
  22.   // troubleshooting.
  23.   Serial.println("8x8 LED 矩阵测试");
  24.   // set the address
  25.   matrix.begin(0x70);
  26. }
  27. void loop() {         
  28. // clear display        
  29. matrix.clear();      
  30. // draw a retangle around the outer edge      
  31. // of the display      
  32. matrix.drawRect(1,0, 7,8, LED_ON);      
  33. // uncomment below      
  34. // will draw a rectangle arond the edge and      
  35. // fill it in, ie. turn on all of the LEDs      
  36. //matrix.fillRect(0,0, 8,8, LED_ON);      
  37. // write the changes to the display      
  38. matrix.writeDisplay();         
  39. delay(500);      
  40. }        
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-9 21:07:25

实验场景图

【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 07:13:10

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

  实验开源代码

  1. /*
  2.   【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  3.   实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  4.   项目之六:滚动的一串字母
  5.   实验接线:
  6.   VK16k33    UNO
  7.   VIN        5V
  8.   GND        GND
  9.   SCL        A5
  10.   SDA        A4
  11. */
  12. #include <Wire.h>
  13. #include "Adafruit_LEDBackpack.h"
  14. #include "Adafruit_GFX.h"
  15. Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
  16. void setup() {
  17.   Serial.begin(9600);
  18.   Serial.println("8x8 LED Matrix Test");
  19.   // pass in the address
  20.   matrix.begin(0x70);
  21. }
  22. void loop() {
  23.   // scroll some text across the matrix
  24.   matrix.setTextSize(1);
  25.   // Set wrap to false for smooth scrollling
  26.   matrix.setTextWrap(false);
  27.   matrix.setTextColor(LED_ON);
  28.   for (int8_t x = 0; x >= -36; x--) {
  29.     matrix.clear();
  30.     matrix.setCursor(x, 0);
  31.     matrix.print("WoW MoM");
  32.     matrix.writeDisplay();
  33.     delay(100);
  34.   }
  35. }
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 07:29:32

实验场景图  动态图 【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 07:48:13

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

  实验开源代码

  1. /*
  2.   【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  3.   实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  4.   项目之七:流动的斜线
  5.   实验接线:
  6.   VK16k33    UNO
  7.   VIN        5V
  8.   GND        GND
  9.   SCL        A5
  10.   SDA        A4
  11. */
  12. #include <Wire.h>
  13. #include "Adafruit_LEDBackpack.h"
  14. #include "Adafruit_GFX.h"
  15. #ifndef _BV
  16. #define _BV(bit) (1<<(bit))
  17. #endif
  18. Adafruit_LEDBackpack matrix = Adafruit_LEDBackpack();
  19. uint8_t counter = 0;
  20. void setup() {
  21.   Serial.begin(9600);
  22.   Serial.println("VK16K33 test");
  23.   matrix.begin(0x70);  // pass in the address
  24. }
  25. void loop() {
  26.   // paint one LED per row. The HT16K33 internal memory looks like
  27.   // a 8x16 bit matrix (8 rows, 16 columns)
  28.   for (uint8_t i=0; i<8; i++) {
  29. // draw a diagonal row of pixels
  30.     matrix.displaybuffer[i] = _BV((counter+i) % 16) | _BV((counter+i+8) % 16)  ;
  31.   }
  32.   // write the changes we just made to the display
  33.   matrix.writeDisplay();
  34.   delay(100);
  35. counter++;
  36.   if (counter >= 16) counter = 0;  
  37. }
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 08:34:51

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

实验场景图  动态图

  【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 10:51:02

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

  实验开源代码

  1. /*
  2.   【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  3.   实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  4.   项目之八:右向流动显示“SOS Call 9-1-1”
  5.   实验接线:
  6.   VK16k33    UNO
  7.   VIN        5V
  8.   GND        GND
  9.   SCL        A5
  10.   SDA        A4
  11. */
  12. #include <Wire.h>
  13. #include <Adafruit_GFX.h>
  14. #include "Adafruit_LEDBackpack.h"   //necessary
  15. Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
  16. void setup() {
  17.    
  18.   matrix.begin(0x70);  // pass in the address
  19. }
  20. static const uint8_t PROGMEM    // Setting Static Constants for the LED Matrix
  21.   S_bmp[] =                    // Declaring the "S" Shape Bitmap for the Matrix
  22.   { B01111111,                // String of characters dictates each LED position as on or off on 8x8 gird
  23.     B01111111,               // 0 = Off LED 1 = On LED  
  24.     B01100000,
  25.     B01111110,
  26.     B01111110,
  27.     B00000110,
  28.     B11111110,
  29.     B11111110 },
  30.    
  31.   O_bmp[] =               // Declaring the "O" Shape Bitmap for the Matrix
  32.   { B11111111,
  33.     B11111111,
  34.     B11000011,
  35.     B11000011,
  36.     B11000011,
  37.     B11000011,
  38.     B11111111,
  39.     B11111111 },
  40.    
  41.   S2_bmp[] =          // Declaring the second "S" Shape Bitmap for the Matrix
  42.   
  43.   { B01111111,
  44.     B01111111,
  45.     B01110000,
  46.     B01111110,
  47.     B01111110,
  48.     B00000110,
  49.     B11111110,
  50.     B11111110 };
  51. void loop() {
  52.   matrix.clear();                                     // Starting with clear matrix where all LEDs are off
  53.   matrix.drawBitmap(1, 0, S_bmp, 8, 8, LED_ON);      // Drawing the "S" Bitmap according to void setup configuration
  54.   matrix.writeDisplay();                            // With 2000 milisecond delay
  55.   delay(2000);
  56.   matrix.clear();                                    // Transitioning with clear matrix where all LEDs are off
  57.   matrix.drawBitmap(1, 0, O_bmp, 7, 8, LED_ON);     // Drawing the "O" Bitmap according to void setup configuration
  58.   matrix.writeDisplay();                           // With 2000 milisecond delay
  59.   delay(2000);
  60.   matrix.clear();                                    // Transitioning with clear matrix where all LEDs are off
  61.   matrix.drawBitmap(1, 0, S2_bmp, 7, 8, LED_ON);    // Drawing the second "S" Bitmap according to void setup configuration
  62.   matrix.writeDisplay();                           // With 2000 milisecond delay
  63.   delay(2000);
  64.   matrix.setTextSize(1);                          // Setting matrix text size to 1
  65.   matrix.setTextWrap(false);                     // Preventing text wrapping to scroll text continuously through matrix
  66.   matrix.setTextColor(LED_ON);                  // Turning LED On
  67.   for (int8_t x=0; x>=-36; x--) {              // Setting for loop to position letters side by side for the scroll
  68.     matrix.clear();                           // Transitioning with clear matrix where all LEDs are off
  69.     matrix.setCursor(x,0);                   // Defining letter positions to print one at time side by side
  70.     matrix.print(" Call");                   // Printing "Call" on the matrix
  71.     matrix.writeDisplay();                 // With 100 milisecond delay
  72.     delay(100);
  73.   }
  74.   matrix.setRotation(0);                  // Prevent rotation and keep scroll at the same angle
  75.   for (int8_t x=7; x>=-36; x--) {        // Setting new for loop to position letters side by side for the scroll
  76.     matrix.clear();                     // Transitioning with clear matrix where all LEDs are off
  77.     matrix.setCursor(x,0);             // Defining letter positions to print one at time side by side
  78.     matrix.print("9-1-1");            // Printing "9-1-1" on the matrix
  79.     matrix.writeDisplay();           // With 100 milisecond delay
  80.     delay(100);
  81.   }
  82. }
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 11:12:42

实验场景图  动态图

【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 11:49:56

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


【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 11:51:13

【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 13:18:11

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

  实验开源代码

  1. /*
  2.   【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  3.   实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  4.   项目之九:循环显示垂直条
  5.   实验接线:
  6.   VK16k33    UNO
  7.   VIN        5V
  8.   GND        GND
  9.   SCL        A5
  10.   SDA        A4
  11. */
  12. #include <Wire.h>
  13. #include "Grove_LED_Matrix_Driver_HT16K33.h"
  14. Matrix_8x8 matrix;
  15. void setup() {
  16.   Wire.begin();
  17.   matrix.init();
  18.   matrix.setBrightness(0);
  19.   matrix.setBlinkRate(BLINK_OFF);
  20. }
  21. void loop() {
  22.   for (int i = 0; i < 33; i++) {
  23.     // writeBar的输入范围是[0-32]
  24.     matrix.writeBar(i);
  25.     matrix.display();
  26.     delay(150);
  27.   }
  28. }
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 13:27:05

实验场景图  动态图  【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 16:13:50

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

  实验开源代码

  1. /*
  2.   【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  3.   实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  4.   项目之十:显示12个自定义图片
  5.   实验接线:
  6.   VK16k33    UNO
  7.   VIN        5V
  8.   GND        GND
  9.   SCL        A5
  10.   SDA        A4
  11. */
  12. #include <Wire.h>
  13. #include "Grove_LED_Matrix_Driver_HT16K33.h"
  14. // 创建 uint64_t 类型的 8x8 矩阵图片在如下网址
  15. // https://xantorohara.github.io/led-matrix-editor/#
  16. const uint64_t EXAMPLE[12] = {
  17.     0x5554545050404000,
  18.     0x3f21212121212121,
  19.     0x3f212d2121212121,
  20.     0x3f212d212d212121,
  21.     0x3f212d212d212d21,
  22.     0x3f212d2d2d212121,
  23.     0x3f212d2d2d2d2d2d,
  24.     0x00040a1120408000,
  25.     0x081c3e7f1c1c1c1c,
  26.     0x0010307fff7f3010,
  27.     0x1c1c1c1c7f3e1c08,
  28.     0x00080cfefffe0c08
  29. };
  30. Matrix_8x8 matrix;
  31. void setup() {
  32.     Wire.begin();
  33.     matrix.init();
  34.     matrix.setBrightness(0);
  35.     matrix.setBlinkRate(BLINK_OFF);
  36. }
  37. void loop() {
  38.     matrix.writeOnePicture(EXAMPLE[11]);
  39.     matrix.display();
  40.     delay(500);
  41.     matrix.writePictures(EXAMPLE, 12, 1000, ACTION_SCROLLING);
  42.     matrix.display();
  43. }
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 16:39:10

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

实验场景图  动态图

【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-10 16:41:06

实验场景图  动态图之二 【Arduino】168种传感器系列实验(207)--- HT16k33 LED8*8点阵I2C图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-9-11 07:47:00

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

  实验开源代码

  1. /*
  2.   【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  3.   实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  4.   项目十一:滚动的小球
  5.   实验接线:
  6.   VK16k33    UNO
  7.   VIN        5V
  8.   GND        GND
  9.   SCL        A5
  10.   SDA        A4
  11. */
  12. #include <Wire.h>
  13. #include <Adafruit_GFX.h>
  14. #include "Adafruit_LEDBackpack.h"
  15. Adafruit_24bargraph bar = Adafruit_24bargraph();
  16. void setup() {
  17.   Serial.begin(9600);
  18.   Serial.println("HT16K33 Bi-Color Bargraph test");
  19.   
  20.   bar.begin(0x70);  // pass in the address
  21.   for (uint8_t b=0; b<24; b++ ){
  22.     if ((b % 3) == 0)  bar.setBar(b, LED_RED);
  23.     if ((b % 3) == 1)  bar.setBar(b, LED_YELLOW);
  24.     if ((b % 3) == 2)  bar.setBar(b, LED_GREEN);
  25.   }
  26.   bar.writeDisplay();
  27.   delay(2000);
  28. }
  29. void loop() {
  30. for (uint8_t b=0; b<24; b++) {
  31.    bar.setBar(b, LED_RED);
  32.    bar.writeDisplay();
  33.    delay(50);
  34.    bar.setBar(b, LED_OFF);
  35.    bar.writeDisplay();
  36. }
  37.   for (uint8_t b=0; b<24; b++) {
  38.    bar.setBar(b, LED_GREEN);
  39.    bar.writeDisplay();
  40.    delay(50);
  41.    bar.setBar(b, LED_OFF);
  42.    bar.writeDisplay();
  43. }
  44. for (uint8_t b=0; b<24; b++) {
  45.    bar.setBar(36-b, LED_YELLOW);
  46.    bar.writeDisplay();
  47.    delay(50);
  48.    bar.setBar(42-b, LED_OFF);
  49.    bar.writeDisplay();
  50. }
  51. }
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail