Hello. I would like some guidance regarding multiple strcmp statements. I have found a simmilar post but the issue not been solved:
I have a variable item_inside.state. I want to compare whether it is set to "PILDYMAS" or "DISABLED" and if it is not either 2 of those, I want to read the sensor, else dont read the sensor.
Unfortunately, the above code just does not work. Even though I have set my state to "PILDYMAS" or '"DISABLED" it still performs read_sensor_no_delay function.
Has anyone else faced this issue? Can this be fixed?
Hey. Thanks for the response. I cannot fully get my head around on what you said. Now I do not know anymore whether I understand IF statement correctly. For example if my state is "IDLE" and I compare it with both "PILDYMAS" and "DISABLED", then the comparison !=0 will be TRUE because "IDLE" is not equal to "PILDYMAS" or "DISABLED". However, if I set my state to "DISABLED" and then do comparison, since one of the condition in if statement is met , it should return false. The same with the following:
The following will return true because one of the contition is met