I seem to have an issue where by if I do a digitalRead on pin 8, if I don't have anything connected to pin 8 it reads low however as soon as I connect a cable without anything attached, thats right a wire with nothing on the end the Arduino reads high.
My code is as follows
val = digitalRead(8);
if (val == 1)
Any ideas why this is?
Common noob problem.
If I set my multimeter to the millivolts range, and wave the cables around in the air, it gives “readings”. Same thing.
If I set my multimeter to the millivolts range, and wave the cables around in the air, it gives "readings".
Yup, my new LED-based electrician's screwdriver scared the pants off me the first time it flashed, a good 20cm from anything solid or conductive.
If I wave the cat around in the air, that gives readings too.
What do you intend to do with that pin? If you want to sense a button with it, you need pullup or pulldown resistors.
Arduino has built-in pullups, just set the pin as INPUT and HIGH. Lovely bit of part-count reduction there.