ตัวอย่าง KidBright with Arduino IDE : ควบคุม LED Matrix 16x8ตัวอย่างนี้เป็นการควบคุม LED Matrix 16x8 ของ KidBright
โดยเบื้องต้น LED Matrix 16x8 นี้จะถูกควบคุมผ่าน I2C Bus ที่ Address 0x70
และจำเป็นต้องมี Library Adafruit_GFX และ Adafruit_LEDBackpack ติดตั้งไว้ใน Arduino IDE ก่อน
ตัวอย่างต่อไปนี้ จะเป็นการแสดงตัวอักษร
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_8x16minimatrix matrix = Adafruit_8x16minimatrix();
void setup() {
matrix.begin(0x70); // pass in the address
}
void loop() {
matrix.setTextSize(1);
matrix.setTextWrap(false); // we dont want text to wrap so it scrolls nicely
matrix.setTextColor(LED_ON);
matrix.setRotation(1);
for (int8_t x=7; x>=-100; x--) {
matrix.clear();
matrix.setCursor(x,0);
matrix.print("Hello World!");
matrix.writeDisplay();
delay(100);
}
}
แก้ไขเพิ่มเติมจาก :
PIEAcademy - NETPIE-KidBright-Workshop2018
