Skip to content

Commit 1f3e9bb

Browse files
Bluetooth Timer
In this project when given input from Bluetooth, We start the Bluetooth Timer.
1 parent cb69d45 commit 1f3e9bb

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
//*LCD INITIALIZATION*//
2+
#include <LiquidCrystal.h>
3+
const int rs=47,rw=46, en=45, d0=44, d1=43, d2=42, d3=41, d4 = 40, d5 = 39, d6 = 38, d7 = 37;
4+
LiquidCrystal lcd(rs, rw,en,d0,d1,d2,d3, d4, d5, d6, d7);
5+
6+
int count;
7+
int count1;
8+
int count2;
9+
int buzzer=31;
10+
int LED1=22;
11+
int LED2=23;
12+
int LED3=24;
13+
14+
char c;
15+
16+
void setup(){
17+
lcd.begin(16,2); //SELECTING LCD COLUMNS & ROWS
18+
Serial.begin(9600); //INITALIZING SERIAL COMMUNICATION
19+
Serial2.begin(9600); //INITALIZING BLUETOOTH SERIAL COMMUNICATION
20+
pinMode(LED1,OUTPUT); //DIFINING LED1 AS OUTPUT DEVICE
21+
pinMode(LED2,OUTPUT); //DIFINING LED21 AS OUTPUT DEVICE
22+
pinMode(LED3,OUTPUT); //DIFINING LED21 AS OUTPUT DEVICE
23+
pinMode(buzzer,OUTPUT); //DIFINING BUZZER AS OUTPUT DEVICE
24+
digitalWrite(LED1,HIGH); //INITIALIZING LED1 OFF
25+
digitalWrite(LED2,HIGH); //INITIALIZING LED2 OFF
26+
digitalWrite(LED3,HIGH); //INITIALIZING LED2 OFF
27+
lcd.write("PLZ SET TIMER");
28+
lcd.setCursor(0,1);
29+
lcd.write("USING BLUETOOTH");
30+
}
31+
void loop(){
32+
lcd.noDisplay();
33+
delay(500);
34+
lcd.display();
35+
here: lcd.clear();
36+
lcd.write("! SET TIMER !");
37+
lcd.setCursor(0,1);
38+
lcd.write("USING BLUETOOTH");
39+
delay(500);
40+
if (Serial2.available()){ //IF BLUETOOTH IS CONNECTED
41+
c=Serial2.read(); //SERIALLY READ FROM BLUETOOTH IS 'c'
42+
}
43+
if(c=='1')
44+
{
45+
for(count=10;count>=0;count--){
46+
digitalWrite(LED1,LOW);
47+
lcd.clear();
48+
lcd.print(count);
49+
lcd.setCursor(0,1);
50+
lcd.print("! START STRECH !");
51+
delay(1000);
52+
}
53+
digitalWrite(LED1,HIGH);
54+
lcd.clear();
55+
lcd.print("!! STOP !!");
56+
digitalWrite(buzzer,HIGH);
57+
delay(500);
58+
digitalWrite(buzzer,LOW);
59+
goto here;
60+
}
61+
if(c=='2'){
62+
for(count1=20;count1>=0;count1--)
63+
{
64+
digitalWrite(LED2,LOW);
65+
lcd.clear();
66+
lcd.print(count1);
67+
lcd.setCursor(0,1);
68+
lcd.print("! JUMPING JACK !");
69+
delay(1000);
70+
}
71+
digitalWrite(LED2,HIGH);
72+
lcd.clear();
73+
lcd.print("!! STOP !!");
74+
digitalWrite(buzzer,HIGH);
75+
delay(500);
76+
digitalWrite(buzzer,LOW);
77+
goto here;
78+
}
79+
if(c=='3'){
80+
for(count2=30;count2>=0;count2--)
81+
{
82+
digitalWrite(LED3,LOW);
83+
lcd.clear();
84+
lcd.print(count2);
85+
lcd.setCursor(0,1);
86+
lcd.print("! SQUATS !");
87+
delay(1000);
88+
}
89+
digitalWrite(LED3,HIGH);
90+
lcd.clear();
91+
lcd.print("!! STOP !!");
92+
digitalWrite(buzzer,HIGH);
93+
delay(500);
94+
digitalWrite(buzzer,LOW);
95+
goto here;
96+
}}
97+
/*else
98+
{
99+
lcd.clear();
100+
lcd.write("WRONG INPUT"); //LCD OUTPUT
101+
Serial2.println("WRONG INPUT,PLZ CHECK & REENTER");
102+
digitalWrite(LED1,HIGH); //LED1 OFF
103+
digitalWrite(LED2,HIGH); //LED2 OFF
104+
digitalWrite(LED3,HIGH); //LED3 OFF
105+
}}*/

0 commit comments

Comments
 (0)