Go Down

Topic: Arduino inputs when uC powered up (Read 489 times) previous topic - next topic

Graynomad

Quote
But I guess it wouldn't matter because the switch that's active will be the only one that is low, and the rest of the inputs should be high, correct?

Yep.

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Ashduino

Thanks again guys, you have both been a great help with my project.

Ash  8)

retrolefty


Hi Ash

The code will read the present state of the input at the time you read - it doesn't rely on watching for a change (unless you want it to) so if a switch is already set on power up it will be fine.  The time from power on to getting to the first pin state read will be measured in milliseconds.  If this is a push-button switch I'm expecting that will be fine as they don't change that quickly.

You're right to point out the linear regulator but that can be bypassed by feeding 5V from a switch mode supply, battery etc into the 5V pin directly.

Geoff


Will it be just milliseconds? Or does it not have to wait for the bootloader to 'time-out' after waiting a fixed amount of time to see if there is an active upload request coming from the IDE?

Bootloader behaviour on how long it waits has changed over the years depending on the specific bootloader version installed on the chip. Seems to me the some older bootloader designs always waited a fixed period (some seconds? checking for a upload request) no matter if the bootloader started via a hardware reset or a power-up state. Seems that (some?) new bootloaders do the IDE upload check only after a reset condition, but if it was a power up condition it does a 'no wait' and will immediately jump to the users code (assuming there was one burned to flash from a prior upload to jump to).

Just asking, as the now pretty long legacy of Arduino hardware and software can create some rather confusing situations for users depending on the age of their boards.

Lefty

strykeroz

Hi Lefty

I totally get what you're saying.  Certainly I meant from the time his user code starts running to the first time it will be possible to read his switch pin states.

Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Boffin1

I used to use the Holtek HT12 encoder chips in remote controls for years, and just supplied power to the chip when any button is pressed, and it transmits virtually instantaneously.
Then I got introduced to Arduino, and thought I could do the same, but it takes several seconds ( the way I had it set up in my ignorance ) for the chip to boot up and transmit,  so I opted for the sleep mode and an interrupt on the buttons. ( I have the chip on a separate PCB and power the transmitter and LED from the press to talk pin, so that only the 328 chip is drawing any current in sleep.

I am using 3 AA batteries so there is no regulator to draw current

I basically copied the sleep code Crossroads posted, and get the quiescent current down to 350 microamps.  Some of the  guys get it down much lower, but at some point the shelf life of the battery runs out.

The batteries last a season ( Sports scoreboards )  before changing
With my mobile phone I can call people and talk to them -  how smart can you get ?

Go Up