this code works fine: Code: void setup(){ Serial.begin(115200); } void loop() { if(Serial.available()>0) { char character = Serial.read(); if(character=='1') { Serial.println("STATUS ON"); } else if(character=='0') { Serial.println("STATUS OFF"); } } } this code does not work at all (added last else) Code: void setup(){ Serial.begin(115200); } void loop() { if(Serial.available()>0) { char character = Serial.read(); if(character=='1') { Serial.println("STATUS ON"); } else if(character=='0') { Serial.println("STATUS OFF"); } else Serial.println("UNKNOWN"); } } Can anyone explain why? Regards, Boris
Hi Boris, Could you please try the code below? Code: void setup(){ Serial.begin(115200); } void loop() { if(Serial.available()>0) { char character = Serial.read(); if(character=='1') { Serial.println("STATUS ON"); } else if(character=='0') { Serial.println("STATUS OFF"); } else { Serial.println("UNKNOWN"); } } I can't try this right now, because I don't have my UDOO with me at the moment... Reference: http://arduino.cc/en/Reference/else