-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simple Texting (BTH).ino
89 lines (72 loc) · 1.26 KB
/
Simple Texting (BTH).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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <LiquidCrystal.h>
char str[34],L=2;
int temp=0,i=0;
int Pass=0,p=0;
int c,x,d;
int blue = 13;
LiquidCrystal lcd(11, 10, 6, 5, 4, 3);
//INSTRUCTIONS;
//Use a bluetooth arduino app to transfer text to the board using the module;
void setup()
{
Serial.begin(9600);
pinMode(blue, OUTPUT);
pinMode(A1,OUTPUT);
pinMode(A0,OUTPUT);
pinMode(4,OUTPUT);
digitalWrite(A1,LOW);
digitalWrite(A0,LOW);
digitalWrite(4,LOW);
lcd.begin(16, 2);
}
void loop()
{
digitalWrite(blue, HIGH);
if(temp==1)
{
check();
temp=0;
i=0;
delay(1000);
}
}
void serialEvent()
{
while (Serial.available())
{
char inChar=Serial.read();
str[i++]=inChar;
delay(10);
}
for (p=i+1;p<34;p++)
{
str[i++]=32;
}
temp=1;
Serial.write(str);
lcd.setCursor(0, 0);
lcd.print(str);
if(i>16)
{
d=16;
for (x=0;x<=17;x++)
{
lcd.setCursor(x,2);
lcd.print(str[d]);
d++;
}
}
}
void check()
{
if(!(strncmp(str,"1",1)))
{
digitalWrite(A1,50);
lcd.clear();
}
else if(!(strncmp(str,"2",1)))
{
digitalWrite(A1,LOW);
lcd.clear();
}
}