Hey guys, am working on an android phone enabled control system to turn on and off lights.
Basically am using an android phone, ardudroid app, BT module , arduino and relays. I got some code online below, but it seems not to fuction properly.
int LED = 12;
char input;
void setup()
{
Serial.begin(9600);
pinMode(LED, OUTPUT );
Serial.println( " >> START << ");
}
void loop()
{
if(Serial.available()>0 )
{
input = Serial.read();
if(input=='1')
{
Serial.println(" ON ");
digitalWrite(LED , HIGH);
}
else if (input == '0')
{
Serial.println( " OFF ");
digitalWrite (LED, LOW );
}
else
{
Serial.println(" NO RESULT ");
Serial.println(input);
}
}
}
Using the code above, the LED goes on for all numbers sent apart from zero yet i want the LED to go on when i send only one number say one.
Can any one help me make the necessary changes? Thanks