-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguitarbluetooth.ino
executable file
·66 lines (56 loc) · 1.27 KB
/
guitarbluetooth.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <SoftwareSerial.h>
//SoftwareSerial mySerial1(10,11); // RX, TX
//SoftwareSerial mySerial2(8, 9); // RX, TX
void setup() {
Serial.begin(38400);
pinMode(9,OUTPUT);
// pinMode(13,OUTPUT);
while (!Serial) {
;
}
Serial1.begin(9600);
Serial2.begin(9600);
//mySerial2.begin(9600);
//Serial.print("Hello");
}
void loop() {
int i,j,i1,j1;
/*if(Serial1.available())
{
i1=Serial1.read();
Serial.print(char(i1));
}*/
if(Serial1.available()&&Serial2.available())
{
i=Serial1.read();
j=Serial2.read();
Serial1.write(1);
Serial2.write(1);
//Serial.print(char(i));
//Serial.println(char(j));
while(!Serial1.available())
{
if(Serial2.available())
{
j=Serial2.read();
Serial2.write(1);
}
if((char(i)!='0')&&(char(j)!='b'))//Serial1 must be connected to fret board app and Serial2 must be connected to strum app
{
Serial.print(char(i));
//Serial.println(char(j));
//Serial.print("a");
}
else
{
Serial.print("b");
}
//prevj=j;
}
i=Serial1.read();
Serial1.write(1);
}
Serial1.flush();
Serial2.flush();
Serial.flush();
}