digitalRead() get compared with GPIO.LOW or GPIO.HIGH.
What kind of array could I set up to collect and compare the state to it?
usually I do:
boolean[] values = {false,false,false};
if(GPIO.digitalRead(4) == values[0]){
//do something
}
but this throws an error
kll
2
say use for compare
if (GPIO.digitalRead(4) == GPIO.LOW)
and also that it talks as
Returns int
possibly
if (GPIO.digitalRead(4) == 1) {}
can work,
but also your boolean array could work with:
if (GPIO.digitalRead(4) == int(values[0]) ) {}
1 Like