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@8:5f5ceafa826d, 2017-12-11 (annotated)
- Committer:
- maclobdell
- Date:
- Mon Dec 11 19:23:47 2017 +0000
- Revision:
- 8:5f5ceafa826d
- Parent:
- 7:1bd79d71396a
updated to demonstrate new playText function which parses through a sentence and either shows or scrolls each word depending on the size
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
maclobdell | 8:5f5ceafa826d | 1 | /* |
maclobdell | 8:5f5ceafa826d | 2 | * Copyright (c) 2016 ARM Limited. All rights reserved. |
maclobdell | 8:5f5ceafa826d | 3 | * SPDX-License-Identifier: Apache-2.0 |
maclobdell | 8:5f5ceafa826d | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
maclobdell | 8:5f5ceafa826d | 5 | * not use this file except in compliance with the License. |
maclobdell | 8:5f5ceafa826d | 6 | * You may obtain a copy of the License at |
maclobdell | 8:5f5ceafa826d | 7 | * |
maclobdell | 8:5f5ceafa826d | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
maclobdell | 8:5f5ceafa826d | 9 | * |
maclobdell | 8:5f5ceafa826d | 10 | * Unless required by applicable law or agreed to in writing, software |
maclobdell | 8:5f5ceafa826d | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
maclobdell | 8:5f5ceafa826d | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
maclobdell | 8:5f5ceafa826d | 13 | * See the License for the specific language governing permissions and |
maclobdell | 8:5f5ceafa826d | 14 | * limitations under the License. |
maclobdell | 8:5f5ceafa826d | 15 | */ |
maclobdell | 8:5f5ceafa826d | 16 | |
maclobdell | 0:2eec8a9428ea | 17 | #include "mbed.h" |
maclobdell | 0:2eec8a9428ea | 18 | |
maclobdell | 6:8d2eb79a4baf | 19 | #include "Adafruit_32x8matrix.h" |
maclobdell | 8:5f5ceafa826d | 20 | |
maclobdell | 6:8d2eb79a4baf | 21 | #define I2C_ADDR1 0x70 |
maclobdell | 6:8d2eb79a4baf | 22 | #define I2C_ADDR2 0x71 |
maclobdell | 6:8d2eb79a4baf | 23 | #define ROTATION1 0 |
maclobdell | 6:8d2eb79a4baf | 24 | #define ROTATION2 2 |
maclobdell | 6:8d2eb79a4baf | 25 | #define BRIGHTNESS 1 |
maclobdell | 8:5f5ceafa826d | 26 | |
maclobdell | 0:2eec8a9428ea | 27 | I2C i2c(D14, D15); |
maclobdell | 8:5f5ceafa826d | 28 | |
maclobdell | 6:8d2eb79a4baf | 29 | Adafruit_32x8matrix matrix(&i2c, I2C_ADDR1, I2C_ADDR2, ROTATION1, ROTATION2, BRIGHTNESS); |
maclobdell | 8:5f5ceafa826d | 30 | |
maclobdell | 0:2eec8a9428ea | 31 | int main() { |
maclobdell | 8:5f5ceafa826d | 32 | char buffer [50]; |
maclobdell | 7:1bd79d71396a | 33 | |
maclobdell | 8:5f5ceafa826d | 34 | while(1) |
maclobdell | 8:5f5ceafa826d | 35 | { |
maclobdell | 8:5f5ceafa826d | 36 | snprintf(buffer, 50, "Hi, how are you today?\0"); //pass in max chars to prevent overflow |
maclobdell | 8:5f5ceafa826d | 37 | matrix.playText(buffer,strlen(buffer), 1); |
maclobdell | 8:5f5ceafa826d | 38 | |
maclobdell | 4:8641e4da6744 | 39 | Thread::wait(10000); |
maclobdell | 4:8641e4da6744 | 40 | } |
maclobdell | 8:5f5ceafa826d | 41 | |
maclobdell | 1:dd1d1b64b9a5 | 42 | } |