Hi, I am working on a small home project that turns on an AC load for a specified amount of time, once a button is pressed.
Everything works as long as I power it with 5V through USB, however, when I power it through 12V VCC, the digitalRead(10) always pulled to HIGH.
I have no idea what could be causing this, but I did make a small discovery, when powered through USB (or VCC while USB plugged in), it works, and the voltage from Digital Pin 10 to GND (with nothing connected to the pin), is about 30mV.
But when testing the same thing while connected through 12V VCC, the pin to GND voltage is approx 1.5V, which seems to be triggering the digitalRead() to output HIGH at all times.
It's probably an issue with my wiring as I tried a few different pins and another Arduino, which produced the same results. I have attached the beadboard layout & schematic (the PSU shown is not the same one that I am using, however, it is also 12VDC).
Any help would be greatly appreciated!
Thanks,
Kaii
---------------------------CODE-------------------------------
int ButtonPress = 0;
Or, the easiest solution is to enable the internal pull-up resistor which will pull the input high with no connection. Then wire the switch so it grounds the input when the button is pushed. (You'll have to reverse your software logic.)
I have no idea what could be causing this, but I did make a small discovery, when powered through USB (or VCC while USB plugged in), it works, and the voltage from Digital Pin 10 to GND (with nothing connected to the pin), is about 30mV.
But when testing the same thing while connected through 12V VCC, the pin to GND voltage is approx 1.5V, which seems to be triggering the digitalRead() to output HIGH at all times.
Hi, I didn't realise the diagram was a bit outdated, as I was testing it with a few pins.
The button is indeed connected to pin 10, not 12.
Yes, when I wrote VCC I meant VIN.
Sorry for the mistakes, posted it very late last night.
DVDdoug, when I connect it in that way, I sometimes (approx every couple 100 reads) get a HIGH reading mixed in with the LOW, while not changing anything, this is when powered through USB.