1#include <Adafruit_GFX.h>
2#include <Adafruit_NeoMatrix.h>
3#include <Adafruit_NeoPixel.h>
4#include <BluetoothSerial.h>
5
6BluetoothSerial BT_Text;
7
8#define PIN 25
9
10Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, PIN,
11 NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
12 NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
13 NEO_GRB + NEO_KHZ800);
14
15int i;
16String Text;
17int x = matrix.width();
18int Size;
19
20const uint16_t colors[] = {
21 matrix.Color(204, 0, 204), matrix.Color(204, 204, 0), matrix.Color(0, 255, 255),
22 matrix.Color(255, 10, 127), matrix.Color(127, 0, 255), matrix.Color(0, 255, 0),
23 matrix.Color(255, 99, 255), matrix.Color(204,177,0), matrix.Color(0,0,244) };
24
25void PrintOut() {
26 while (!BT_Text.available()) {
27 }
28 while (BT_Text.available()) {
29 i = BT_Text.read();
30 Text = Text + char (i);
31 }
32}
33
34
35
36
37void setup() {
38
39 BT_Text.begin("BT_Text");
40 matrix.begin();
41 matrix.setTextWrap(false);
42 matrix.setBrightness(40);
43 matrix.setTextColor(colors[0]);
44 Text = "*MERRY CHRISTMAS*";
45 Size = Text.length()*6;
46}
47
48
49
50void loop() {
51 if (BT_Text.available()) {
52 i = BT_Text.read();
53 if (i < 9) {
54 matrix.setTextColor(colors[i]);
55 }
56 else {
57 Text = "";
58 PrintOut();
59 Size = Text.length()*6;
60 }
61 }
62 matrix.fillScreen(0);
63 matrix.setCursor(x, 0);
64 matrix.print(Text);
65 if ( --x < -Size) {
66 x = matrix.width();
67 }
68 matrix.show();
69 delay(50);
70}
71
resh24
3 months ago
Can I joint one more WS2812b in this so what I change in code so far I make now