Example application for two 16x8 Adafruit LED Backpacks to make a 32 x 8 matrix.
Dependencies: Adafruit_32x8matrix
Fork of Adafruit_LEDBackpack_16x8_App by
This project uses two 16x8 1.2" LED Matrix + Backpacks stuck together to make a 32x8 double-length matrix.
Diff: main.cpp
- Revision:
- 5:f2820d1efc08
- Parent:
- 4:8641e4da6744
--- a/main.cpp Sat Apr 08 02:57:54 2017 +0000 +++ b/main.cpp Mon Apr 10 14:43:42 2017 +0000 @@ -18,6 +18,8 @@ Adafruit_16x8matrix matrix2 = Adafruit_16x8matrix(&i2c); void scrollText(char * buffer, uint8_t buf_len, uint8_t speed); +void showText(char * buffer, uint8_t buf_len, uint8_t duration); + void myidlethread(void); int main() { @@ -36,11 +38,18 @@ matrix.writeDisplay(); char buffer [50]; + + sprintf(buffer, "This\0"); + showText(buffer,strlen(buffer), 1); + sprintf(buffer, "is\0"); + showText(buffer,strlen(buffer), 1); + sprintf(buffer, "the\0"); + showText(buffer,strlen(buffer), 1); sprintf (buffer, "IoT Lab\0"); - + while(1) { - scrollText(buffer,strlen(buffer), 1000); + scrollText(buffer,strlen(buffer), 100); Thread::attach_idle_hook (myidlethread); @@ -67,18 +76,33 @@ for(int j=0; j<buf_len; j++){ /*loop over all of the chars in the text*/ if(xoff > 15){ matrix2.drawChar(xoff + j*6 - 16, 0, buffer[j], 1, 0, 1); - matrix2.writeDisplay(); + }else { matrix.drawChar(xoff + j*6, 0, buffer[j], 1, 0, 1); - matrix.writeDisplay(); matrix2.drawChar(xoff + j*6 - 16, 0, buffer[j], 1, 0, 1); - matrix2.writeDisplay(); } } xoff--; /* decrement x offset*/ - Thread::wait(1000/speed); + matrix.writeDisplay(); + matrix2.writeDisplay(); + Thread::wait(2000/speed); matrix.clear(); matrix2.clear(); } } + + +void showText(char * buffer, uint8_t buf_len, uint8_t duration) +{ + for(int j=0; j<buf_len; j++){ /*loop over all of the chars in the text*/ + matrix.drawChar(j*6, 0, buffer[j], 1, 0, 1); + matrix2.drawChar(j*6 - 16, 0, buffer[j], 1, 0, 1); + } + matrix.writeDisplay(); + matrix2.writeDisplay(); + Thread::wait(1000*duration); + matrix.clear(); + matrix2.clear(); + +} \ No newline at end of file