I’m new to coding and i just got my Arduino Esplora. I strive to learn the coding language, and I don’t understand what “(button == low)” means. What is the difference between when a button returns high or low. Thanks for your time!
Somewhere, another statement looked at the voltage on one of the digital pins. Presumably that pin was connected to a button. If the voltage on the pin was greater than about 3 V, it registers as logic state "high", if less than about 2 V, it registers as logic state "low".
Your snippet tests whether the pin connected to the button was at logic state low. If it is low, the expression returns 1, which is true. If button is logic state high, the test will fail returning 0 or false.
Im using the Esplora, which comes with built in switch buttons. Are they above 5 volts or are they lower? they are not connected to any pins. And why would a high fail? Im so confused
Ldiaz1240: Im using the Esplora, which comes with built in switch buttons. Are they above 5 volts or are they lower? they are not connected to any pins. And why would a high fail? Im so confused
I am sure the buttons are connected to the pins on the MCU.
"high" fails because of the way the question was asked.
(button == low) is asking the question "Is the value of button low?" It works like this:
IF the value of button is "low", THEN set the value of the expression to true ELSE set the value of the expression to false.