Quick question:
Is the below correct if i want to read a push button on analog pin (0)?
its a rough version i know, but i just want to check the important parts...
pinmode(14,input); // set the pin to input
int BUTTON = digitalread(14); // read analog pin 0 as digital and set it to a variable
if (BUTTON == HIGH) // it shows pressed
else if (BUTTON == LOW) // it shows not pressed
hardware layout:
5v___button____10k ohm resistor___ground
|___analog pin 0
layout done as shown in:
ww.arduino.cc/en/Tutorial/Button
Thanks