Hi all,
I am trying to read the text which I am sending/typing on the serial monitor. and reading that text or char to match with a letter and then making IR send. But it is not matching. And if it matches it always takes the first condition for turning On only.
Here's my code:
void loop(){
if (Serial.available()>0){
delay(50);
if (Serial.readString() == "on" or 1){
mySender.send(tv_on,RAW_DATA_LEN,38);//Pass the buffer,length, optionally frequency
Serial.println(F("TV is ON/OFF"));
}
if(Serial.readString() == "up" or 2){
delay(50);
mySender.send(tv_volume_up,RAW_DATA_LEN,38);//Pass the buffer,length, optionally frequency
Serial.println(F("TV Volume is UP"));
}
if (Serial.readString() == "down" or 3){
delay(50);
mySender.send(tv_volume_down,RAW_DATA_LEN,38);//Pass the buffer,length, optionally frequency
Serial.println(F("TV Volume is Down"));
}
if (Serial.readString() == "m"){
delay(50);
for (int i = 50; i > 0 ; i--){
mySender.send(tv_volume_down,RAW_DATA_LEN,38);//Pass the buffer,length, optionally frequency
Serial.println(F("TV is Mute"));
delay(40);
}
}
}
}
Please Help me regarding this.