7472| 2
|
[进阶] 点亮一个IIC的8x8点阵模块 |
大家好,今天给大家介绍怎么点亮一个IIC的点阵。平常大家见的最多的是MAX7219点阵模块。相比较而言,IIC的点阵更方便。下面给大家介绍的是合泰的16k33点阵驱动模块和Arduino UNO连接后。点亮一个8x8的点阵。 下面是合泰的点阵驱动 下面是连线图 因为是IIC的驱动,因此只需要连4根线。SDA-A4.SCL-A5。VCC-VCC,GND-GND [mw_shl_code=applescript,true]#include <Wire.h> #include <Adafruit_GFX.h> #include "Adafruit_LEDBackpack.h" Adafruit_8x8matrix matrix = Adafruit_8x8matrix(); void setup() { Serial.begin(9600); Serial.println("8x8 LED Matrix Test"); matrix.begin(0x70); // pass in the address } static const uint8_t PROGMEM smile_bmp[] = { B00111100, B01000010, B10100101, B10000001, B10100101, B10011001, B01000010, B00111100 }, frown_bmp[] = { B00111100, B01000010, B10100101, B10000001, B10011001, B10100101, B01000010, B00111100 }; void loop() { matrix.clear(); matrix.drawBitmap(0, 0, smile_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(1000); matrix.clear(); matrix.drawBitmap(0, 0, frown_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(1000); matrix.clear(); // clear display matrix.setTextSize(1); matrix.setTextWrap(false); // we dont want text to wrap so it scrolls nicely matrix.setTextColor(LED_ON); for (int8_t x=0; x>=-36; x--) { matrix.clear(); matrix.setCursor(x,0); matrix.print("GADA888"); matrix.writeDisplay(); delay(100); } matrix.setRotation(2); for (int8_t x=7; x>=-36; x--) { matrix.clear(); matrix.setCursor(x,0); matrix.print("GADA888"); matrix.writeDisplay(); delay(100); } matrix.setRotation(0); } [/mw_shl_code] 记得加入运行库 |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed