Skip to content

Commit c8fdca7

Browse files
authored
Add files via upload
1 parent 5edf963 commit c8fdca7

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

bt_matrix/bt_matrix.ino

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#include "BluetoothSerial.h"
2+
#include <Adafruit_GFX.h>
3+
#include <Adafruit_IS31FL3731.h>
4+
BluetoothSerial SerialBT;
5+
Adafruit_IS31FL3731 matrix = Adafruit_IS31FL3731();
6+
int matrix_speed = 200;
7+
int matrix_br = 50;
8+
9+
void setup() {
10+
Serial.begin(115200);
11+
SerialBT.begin("ESP32_17"); //이름 넣기
12+
matrix.begin();
13+
matrix.setTextColor(matrix_br);
14+
}
15+
16+
void loop() {
17+
char temp[10];
18+
memset(temp, 0, sizeof(temp));
19+
if (SerialBT.available()>0) {
20+
char data = SerialBT.read();
21+
Serial.write(data);
22+
if (data == '1') {
23+
SerialBT.readBytes(temp, 10);
24+
Serial.write(temp);
25+
for (int x = 0; x>= -30; x--) {
26+
matrix.clear();
27+
matrix.setCursor(x, 1);
28+
matrix.print(temp);
29+
delay(matrix_speed);
30+
}
31+
matrix.clear();
32+
}
33+
34+
if (data == '2') {
35+
int speed = SerialBT.read();
36+
matrix_speed = (200-(speed * 2));
37+
Serial.println("speed");
38+
Serial.println(matrix_speed);
39+
}
40+
41+
if (data == '3') {
42+
matrix_br = SerialBT.read();
43+
matrix.setTextColor(matrix_br);
44+
Serial.println("bright");
45+
Serial.println(matrix_br);
46+
}
47+
}
48+
49+
}

0 commit comments

Comments
 (0)