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:
- 4:8641e4da6744
- Parent:
- 2:ffe5cf2557e3
- Child:
- 5:f2820d1efc08
- Child:
- 6:8d2eb79a4baf
--- a/main.cpp Thu Dec 22 20:42:03 2016 +0000 +++ b/main.cpp Sat Apr 08 02:57:54 2017 +0000 @@ -4,31 +4,59 @@ I2C i2c(D14, D15); +//notes and todos- +//need to make the quad display with text scroll into its own class + +//220uA no leds on +//default brightness - rises to 20mA at short peak then back down when scrolling hello +//brightness = 1, rises to ~4mA at short peak then back down when scrolling hello + //mpl - something with stdio screwing things up. need to define serial port to use for debug Serial pc (USBTX,USBRX); Adafruit_16x8matrix matrix = Adafruit_16x8matrix(&i2c); Adafruit_16x8matrix matrix2 = Adafruit_16x8matrix(&i2c); -void scrollText(char * buffer, uint8_t buf_len); +void scrollText(char * buffer, uint8_t buf_len, uint8_t speed); +void myidlethread(void); int main() { matrix2.begin(0x71); + matrix2.setBrightness(1); + matrix2.setRotation(2); + matrix2.clear(); matrix2.writeDisplay(); matrix.begin(0x70); + matrix.setBrightness(1); + matrix.clear(); matrix.writeDisplay(); char buffer [50]; - sprintf (buffer, "Hello\0"); - scrollText(buffer,strlen(buffer)); + sprintf (buffer, "IoT Lab\0"); + + while(1) + { + scrollText(buffer,strlen(buffer), 1000); + + Thread::attach_idle_hook (myidlethread); + + Thread::wait(10000); + } } -void scrollText(char * buffer, uint8_t buf_len) +void myidlethread(void) +{ + sleep(); //go to sleep, wait for an interrupt + +} + + +void scrollText(char * buffer, uint8_t buf_len, uint8_t speed) { //pc.printf("buffer = %s, len = %d\r\n", buffer, buf_len); @@ -49,7 +77,7 @@ } } xoff--; /* decrement x offset*/ - Thread::wait(70); + Thread::wait(1000/speed); matrix.clear(); matrix2.clear(); }