/*Write a program to interface Relay and Bluetooth module
to switch on AC load (5W LED bulb, table lamp, etc)
connected to relay if 1 is passed through Bluetooth
and switch off the AC Load if 0 is send.*/
char data=0;
int relay=8;
void setup() {
Serial.begin(9600);
pinMode(relay, OUTPUT);
// put your setup code here, to run once:
}
void loop() {
if(Serial.available()>0){
data=Serial.read();
Serial.print(data);
Serial.print("\n");
if(data=='1')
digitalWrite(relay, HIGH);
else if(data=='0')
digitalWrite(relay, LOW);
} // put your main code here, to run repeatedly:
}