Signal "1" and "0" convert to the text "start" and "wait"

Hello, could you help me? from the analog button, signal 0 or 1 should go and change to words in the display. Which node should you use?

I put the button on D2. You can round the signal from the pin, Digital or Analog, I used Digital because you said “button” and that’s more appropriate. Then, pass through the “nth-input” for your text slection, either 0 or 1.


And actually, you don’t need the round function for the digital with the “button” node, because it rounds the press for you… but you could use round in interesting ways, like with an analog signal…

Here’s the code without the extra round,

As stated above, a button should use a digital-read, not analog-read. Analog read is almost never going to return 0. Feeding analog output to an if-else will almost always be true, because even 0.000000001 is not zero, and is therefore true. A pull-up resistor for the button will prevent the button press from ever reaching zero when using analog input; not having a pull-up resistor for the button may prevent Arduino from recognizing that the button has been released.

I do like using analog read for multiple buttons on a single input, though!

Analog read for multiple buttons on a single input is an option, but you can not use equal to compare reading to determine which button is being pushed. You might be able to get away with this if you round the number to a specific number of digits before compare, but in general, you will need to do a range compare of analog input, not an equal comparison.

Here’s a basic 5-way analog button for the Voltage Divider method, namely the one for the DFRobot LCD Shield with 5 buttons on analog pin A0. I’ve packaged this node inside other nodes to get the functionality of the buttons I want.

photo showing “Up” button pressed on the LCD-button shield:

I hope this helps!
analog-5way-button-basic.xodball (14.3 KB)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.