I'm a new user but have been lurking in the forum for a while now, as I have been using Arduino for a couple of projects during the course of my EE degree. I am now using it in my MSc thesis but am having an issue that is baffling me.
So I have a big code, and it's running somewhat smoothly, except for one thing: the digital pins 10/11 in the Arduino Uno are always outputting 5V, as if they were initialized as OUTPUT and at HIGH. However, nowhere in my code am I even using those 2 pins. Even if I deliberately initialize those two as INPUT and at LOW, they still are outputting 5V all the time! That doesn't happen with any other pins. What is up with that?
This wouldn't be that much of a big deal but I wonder if there is a bigger problem behind this. I also really need those 2 pins as I have an LCD screen and a few buttons and relays so I'm kind of short on digital pins as is, and am needing at least one of those.
Thank you very much in anticipation for any and all help you can provide!
Are you using SPI.h? The library might be taking them high.
Hard to say more without your code or schematic.
Are you using any of the SPI functions? These pins are part of that suite and so could be being initialised as outputs by that code.
Hard to say without knowing what arduino libraries and built in functions you might be using without seeing your code. One thing you could do is determine if it's a output signal or an input with internal pull-ups enabled. Wire 1k ohm resistors between those pins and ground and see if the signals are still high or not. If yes, then the pins are somehow set to be output pins and set to high, in no, then the it would appear the internal pull-up resistors are enabled for those two pins.
Yes, in fact I am using SPI.h. These are the libraries I’m using:
The pin layout for Arduino is in the attachment below.
A quick search shows that SPI.h uses pins 10, 11, 12 and 13 for its functions. Probably the issue lies in here.
I have to go to work in a little bit, will try to provide as much useful info as I can tomorrow. I’ll also be at the lab during the afternoon to try what Retro_lefty suggested and give you the feedback.
Thank you very much for the help so far!
deliberately initialize those two as INPUT and at LOW, they still are outputting 5V all the time!
Just for the record. If the pin is an INPUT, writing a 0 to it won't cause it to go low. It'll shut off the pull-up resistor which will keep the pin floating.
retrolefty, I just tried your pulldown resistor method and even with the resistor between the pins and ground, I still have 5V in them. So something is setting them to HIGH.
So then I tried running the code without SPI.h and Ethernet.h, commenting all parts related, to see if it was from SPI.h. And indeed it seems to be. Without it, 10 and 11 are behaving normally. I thought it wouldn't be a problem because in the LCD example, they use pins 11 and 12.
Next I'll try to use these buttons in analog inputs and see if it still happens with SPI.h turned on again.
Thank you all!
Without it, 10 and 11 are behaving normally.
Try initialing the pins as inputs after you have set up the SPI pins.
No such luck. I am now 100% positive it's due to the SPI.h library, due to my testing. I went around the issue by using the analog pins as digital inputs, and wiring my buttons there.
Thank you so much everyone for your help!