Go Down

Topic: very new to programming arduino (Read 854 times) previous topic - next topic


hey guys i have just recently picked up arduino programming and have been reading a few guides. i am currently trying to write a code that will count how many times the reset button is pressed on the arduino board. i saw a guide on writing a code that does this with a separate button connected to one of the pins but i am not sure if the same could be done using the built in reset button on the board. i know that to read from a button you would use digital read and specify which pin to read from but i am not sure how i would do this with the built in reset button.

also i want to play with amarino to transfer this information to an android phone via bluetooth. i have been reading a lot about this but still haven't found a definitive solution yet.

thanks guys


That could be done with an external button too, which code you are considering?
"Real Men can Accomplish  Anything"

- skype : nishants5  
ਫ਼ਤੇਹ ਕਰੁਂ!


Jan 11, 2012, 09:46 am Last Edit: Jan 11, 2012, 05:08 pm by cantore Reason: 1
If you use the reset button you have to save your value in a non volatile memory or you will also reset your counter. Count how many times an external button is pressed is an easier project


Jan 11, 2012, 10:52 am Last Edit: Jan 11, 2012, 11:59 am by Grumpy_Mike Reason: 1
how i would do this with the built in reset button.

Generally you would not. That button is only meant for reaseting it is not designed to be used by your sketch.


i would do this with the built in reset button.

Perhaps: use the EEPROM. In the setup routine read the value from EEPROM (if it exists), increment it and store it back. In this way you can count the "boot events".

The reset button is connected to the reset pin on the µC, so you cannot use it as a "normal" button.

best regards

#define true '/'/'/'
#define false '-'-'-'


can you explain more about the EEPROM. I am not sure what the EEPROM does on the arduino board? and why would i read from the EEPROM?
I am probably just going to end up using a external button though. This is the link i was referring to though (http://arduino.cc/en/Tutorial/ButtonStateChange)

so right now i would write a code that would "digitalread" the pin that the external button is connected to and send that through bluetooth to the android phone. i've read that amarino is a good way to send from arduino to android via bluetooth but would my code have to be changed or modified for it to send data through bluetooth. I understand it's just a different type of serial communication.

thanks for the help so far guys.


EEPROM is non volatile memory. That is the values in in persist during reset and power down.
You have no need to use it it was just a way of doing what you asked. But then what you asked was the totally wrong thing in the first place.

Go Up