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.
main.cpp@7:1bd79d71396a, 2017-06-28 (annotated)
- Committer:
- maclobdell
- Date:
- Wed Jun 28 19:44:15 2017 +0000
- Revision:
- 7:1bd79d71396a
- Parent:
- 6:8d2eb79a4baf
- Child:
- 8:5f5ceafa826d
Update example app to use both showing static text and scrolling text
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
maclobdell | 0:2eec8a9428ea | 1 | #include "mbed.h" |
maclobdell | 0:2eec8a9428ea | 2 | |
maclobdell | 6:8d2eb79a4baf | 3 | #include "Adafruit_32x8matrix.h" |
maclobdell | 6:8d2eb79a4baf | 4 | |
maclobdell | 6:8d2eb79a4baf | 5 | #define I2C_ADDR1 0x70 |
maclobdell | 6:8d2eb79a4baf | 6 | #define I2C_ADDR2 0x71 |
maclobdell | 6:8d2eb79a4baf | 7 | #define ROTATION1 0 |
maclobdell | 6:8d2eb79a4baf | 8 | #define ROTATION2 2 |
maclobdell | 6:8d2eb79a4baf | 9 | #define BRIGHTNESS 1 |
maclobdell | 6:8d2eb79a4baf | 10 | |
maclobdell | 6:8d2eb79a4baf | 11 | Serial pc (USBTX,USBRX); |
maclobdell | 6:8d2eb79a4baf | 12 | |
maclobdell | 6:8d2eb79a4baf | 13 | void myidlethread(void); |
maclobdell | 6:8d2eb79a4baf | 14 | |
maclobdell | 0:2eec8a9428ea | 15 | I2C i2c(D14, D15); |
maclobdell | 1:dd1d1b64b9a5 | 16 | |
maclobdell | 6:8d2eb79a4baf | 17 | Adafruit_32x8matrix matrix(&i2c, I2C_ADDR1, I2C_ADDR2, ROTATION1, ROTATION2, BRIGHTNESS); |
maclobdell | 1:dd1d1b64b9a5 | 18 | |
maclobdell | 0:2eec8a9428ea | 19 | int main() { |
maclobdell | 1:dd1d1b64b9a5 | 20 | |
maclobdell | 6:8d2eb79a4baf | 21 | char buffer [50]; |
maclobdell | 4:8641e4da6744 | 22 | |
maclobdell | 6:8d2eb79a4baf | 23 | Thread::attach_idle_hook(myidlethread); |
maclobdell | 7:1bd79d71396a | 24 | |
maclobdell | 7:1bd79d71396a | 25 | sprintf(buffer, "This\0"); |
maclobdell | 7:1bd79d71396a | 26 | matrix.showText(buffer,strlen(buffer), 1); |
maclobdell | 7:1bd79d71396a | 27 | |
maclobdell | 7:1bd79d71396a | 28 | sprintf(buffer, "is\0"); |
maclobdell | 7:1bd79d71396a | 29 | matrix.showText(buffer,strlen(buffer), 1); |
maclobdell | 7:1bd79d71396a | 30 | |
maclobdell | 7:1bd79d71396a | 31 | sprintf(buffer, "the\0"); |
maclobdell | 7:1bd79d71396a | 32 | matrix.showText(buffer,strlen(buffer), 1); |
maclobdell | 7:1bd79d71396a | 33 | |
maclobdell | 7:1bd79d71396a | 34 | sprintf (buffer, "IoT Lab\0"); |
maclobdell | 7:1bd79d71396a | 35 | matrix.scrollText(buffer,strlen(buffer), 100); |
maclobdell | 7:1bd79d71396a | 36 | |
maclobdell | 7:1bd79d71396a | 37 | Thread::wait(1000); |
maclobdell | 7:1bd79d71396a | 38 | |
maclobdell | 7:1bd79d71396a | 39 | sprintf(buffer, "Welcome\0"); |
maclobdell | 7:1bd79d71396a | 40 | |
maclobdell | 4:8641e4da6744 | 41 | while(1) |
maclobdell | 4:8641e4da6744 | 42 | { |
maclobdell | 6:8d2eb79a4baf | 43 | matrix.scrollText(buffer,strlen(buffer), 80); |
maclobdell | 6:8d2eb79a4baf | 44 | |
maclobdell | 4:8641e4da6744 | 45 | Thread::wait(10000); |
maclobdell | 4:8641e4da6744 | 46 | } |
maclobdell | 1:dd1d1b64b9a5 | 47 | |
maclobdell | 1:dd1d1b64b9a5 | 48 | } |
maclobdell | 1:dd1d1b64b9a5 | 49 | |
maclobdell | 4:8641e4da6744 | 50 | void myidlethread(void) |
maclobdell | 4:8641e4da6744 | 51 | { |
maclobdell | 4:8641e4da6744 | 52 | sleep(); //go to sleep, wait for an interrupt |
maclobdell | 4:8641e4da6744 | 53 | |
maclobdell | 4:8641e4da6744 | 54 | } |
maclobdell | 4:8641e4da6744 | 55 | |
maclobdell | 4:8641e4da6744 | 56 |