loading

Arduino Toy with LED indicator; LED, off, no use for 1hr; LED, fades in/out, after 20min; BLinks to button

Sorry about the question title.  Long time listener first time caller. 

I'm developing a toy for my nephew.  He's really into lit objects. 

So I'm trying to write this code in arduino for a basic toy. My nephew doesn't talk much and I thought maybe this would be a great way of him telling us how he feels.  So I'm thinking of creating a basic LED-based indicator.  I was going to connect 3 buttons to LEDS: red, yellow, and green.

Dependent on how he feels, he would press the buttons.  But due to being a kid, his attention span is very short.  To keep him engaged I was thinking about adapting the "screensaver mode" and having the toy use minimal batt power and pulse peacefully in and out.  

IF he's not around, i just wanted it to turn off by itself. Then any one of the buttons would be a failsafe to turn it back on again.  

I'm new to arduino and would love to hear of any suggestions, recommendations, hatemail, chain letters, anything that would elucidate coding.  
I would really appreciate it.  Thank you so much.

Grateful,



 

Coding the naked program isn't too hard. The arduino DOES have sleep and shutdown modes, like the AVR's predecessor the 8052. Its a bit of a pig to invoke it from standard code though.

There is a project out there called "Nightingale"  which has worked with a lot of sleep and watchdog functions.

Steve
verence6 years ago
Apart from what lemonie said, you could teach him hand signs 'thumb up' - I feel good, 'thumb horizontal' - so, so, 'thumb down' - I feel bad. No batteries needed and there is even a backup device in case one thumb gets lost.

But well, back to electronics. I don't know the Arduino, but I guess it has a sleep mode. So I would make a counter and increase the counter with a timer interrupt.
Reset the counter whenever a button is pressed. When the counter has reached a certain limit, go to screen 'saver mode' and flash/fade the LED, when the counter has reached a higher threshold, switch the LEDs of and go to sleep mode.

Waking up is another problem - depending on what the Arduino hardware allows, you could wire the buttons to interrupt inputs and set it to wakeup on interrupt. Otherwise, leave a timer running and wake up by timer every 50ms or so, check the buttons and go to sleep again or back to work.

To save power, you might want to set the operating frequency of the Arduino as low as possible.
lemonie6 years ago

Would you not be better actually getting the lad to talk more?

L