Please help me to modify my Bluetooth sketch. I have Arduino UNO3 board with XBee shield and 2-way relay shield. It is simple operation, just turn one relay on and off. Works fine, but I need to add flashing LED - independent flash on different pin, will use as indicator - my relay on or off. Thanx a lot for help.
Here is my sketch (sorry, no idea how to properly post it):
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(5, OUTPUT);
Serial.begin(9600);
Serial.println(" Lets test the bluetooth module");
Serial.println("Press 1 to light the LED, and 2 to turn it off");
Serial.println("Entery: ");
digitalWrite(5, LOW);
}
void loop() {
if (Serial.available()){
char input = Serial.read();
switch (input){
case '1': //turn led on
digitalWrite(5, LOW); // set the LED on
delay(100); // wait for a second
Serial.println("it works on!!");
break;
case '2':
digitalWrite(5, HIGH); // set the LED off
delay(100); // wait for a second
Serial.println("it works off!!");
break;
}
}
}