Hi There,
I have a requirement where all the Digital Input Pins, apart from 0,1 and 13 are utilized. I have read documentation which indicates that one should steer away from those pins, unless unavoidable. In my case I can't avoid them : I need one more input.
My Input is a from a Set of photo transistors (Which would output either 0 or +5V). When I connect it as it is to Pin13, the values jump to 0 in some cases where I would expect 1(+5). I've connected a 10K Resistor to the Input and grounded it, but it hasnt done much difference.
Can someone advice me on whether the above is the best option in this case ?. Note that I tried to connect Pin 0 and 1 without success...
Pin 13 drives a on-board series resistor and led and this may on may not cause a problem with your photo-transistor trying to drive the input pin high due the the current draw of the led and 1k ohm series resistor. If you are using a Uno or Mega Rev3 board then it should work as there is a op-amp driving the led but on other older boards there is just the load of the led/resistor seen on the shield pin 13. Are you using up all your analog input pins, as they can also be used as digital input or output pins?
Thanks retrolefty for the prompt reply. My Board is a Uno R2. So I guess that One Option is out...However, Yes All my Analog Pins are free...I'll check that option out. Many Thanks!
You could use pin 13 as an input of you desolder the LED connected to that pin. You should also be able to use pin 1 as an input, but you may have to disconnect the phototransistor (or at least keep it in the dark) when uploading sketches.
Thanks Everyone, I've used the Analog Input to work it around and works fine. But I'll try to use the UCSR0B = 0; option too. I assume it's in the setup phase in code ?.
Thanks Clemens and Everyone Else...Yes I do confirm using the Analog Pins as Digital Input Pins (Addressing Analog Pin0 as Digital Pin 14 ..) and it works fine. I did not have to use Digital Pins 0,1 and 13.