Basically I have a Arduino Mega using about 30 digital pins. I'm trying to power 30 light sensors, it works with a dozen or so but if I add more than that its more than the ~500mA @ 5V it can output. I have a 2A @ 5V power adapter but my design needs the arduino to turn up the pins.
Is there any way to "inject" the additional 2A @ 5V into the arduino?
Why do you want to power them through it? Instead of just powering them directly, connect gnd from the power supply and the arduino, and then just look at the feedback from them?
What are your "light sensors"?
How are they wired?
It sounds like you just need a separate supply rail (don't forget to common the grounds).
The "light sensors" are just photo cells.
Yeah I could do that, but I wanted one design for different Arduino's, so I wouldn't need the extra power supply for the mega vs non-mega versions of the code.
I still don't get it... The code shouldn't need to be changed depending on the extra power supply or no extra?
You only need to read the output from the sensors.
One small problem, if I don't set the pins to be HIGH (+5V) then I have a floating input when I set it to LOW instead, and it flip-flops on all the pins...
digitalWrite(i,LOW); // when HIGH there is no floating input problem
That is because you set the internal pull-up.
Try external instead. You should be able to set them to 5V from the extra power supply, and then use the photo resistor to pull down to gnd again.
I don't understand, not all the pins are wired in all the time, what do you mean use external pullup?
I don't understand what you are doing now either.
You need to have more sensors that it can, but they are not all wired up(in?) all the time?
This is a pull down resistor, to pull the floating value down to zero, you can do the same, and then use the sensors to pull it up, instead of the switch.
But then instead use an external 5V supply to pull it up.
Oh duh, nevermind. I forgot that the prototype on my desk here doesn't have that, and the breadboard at location does. I'm sure it will work as soon as I plug it back in! Thanks again!