File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments