Blutooth modual control Arduino Connected Device
HC-05 modual control Arduino programming
int led1 = 2;//pin number D2
int led2 = 3;//pin number D3
char TTRX;
void setup(){
Serial.begin(9600);//serial commuction port number defind 9600
pinMode(led1, OUTPUT);//led1 pin defind output device
pinMode(led2, OUTPUT);//led2 pin defind output device
}
void loop(){
if (Serial.available()){
TTRX = Serial.read();//serial function read data for RX pin
}
if (TTRX == '1'){
}
if (TTRX == '2'){
}
if (TTRX == '3'){
}
if (TTRX == '4'){
}
}
Different void loop programming
(use any of them loop)
void loop(){
switch (TTRX == '1'){
case 0:
digitalWrite(led1, HIGH);
break;
case 1;
digitalWrite(led1, LOW);
break;
}
delay(1);
switch(TTRX == '2'){
case 0:
break;
case 1;
break;
}
delay(1);
}
Divices controlling Application
See Next part Comming Soon
Comments
Post a Comment
Don't enter any scam link