COMPONENTS REQUIRED :
- Arduino UNO
- Bluetooth module (HC-05/HC-06)
- 6 LEDS
- BreadBoard
- Arduino Wires
CODE:
void setup() {
Serial.begin(9600);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
char data;
int x;
if(Serial.available()>0)
{
data=Serial.read();
switch(data)
{
case '1' :{
x=digitalRead(8);
digitalWrite(8,!x);
break;}
case '2' :{
x=digitalRead(9);
digitalWrite(9,!x);
break;}
case '3' :{
x=digitalRead(10);
digitalWrite(10,!x);
break;}
case '4' :{
x=digitalRead(11);
digitalWrite(11,!x);
break;}
case '5' :{
x=digitalRead(12);
digitalWrite(12,!x);
break;}
case '6' :{
x=digitalRead(13);
digitalWrite(13,!x);
break;}
}
}
}
Thank you very much your video realy help me
ReplyDelete