Closed amanjn16 closed 3 years ago
Your comparison is wrong... to compare values you need to use "==" not "=":
if (state==true) ...
Use the short way:
if (state) {
irsend.sendRaw(AC_POWER_OFF, 115, 38);
} else {
irsend.sendRaw(AC_POWER_ON, 243, 38);
}
=
is the assignment operator.
See c++ comparison operators
I am trying to make a IR blaster using switch as device type. It is working great except that I am only able to transmit Switch on code irrespective of whether I turn the device on or off. Please help me correct my code so that IR sends right raw data based on whether I turn device on or off.
(Edit by sivar2311 for better code readability)