I have a speaker set up to my Arduino 101, (which I'll soon most likely replace with an Arduino uno, so if you can do this on one Arduino and not the other please tell me.) and I want it to beep every time I press either the reset button or the master reset button. I don't have high hopes that this is possible but if it please let me know!
I don't know an Arduino101 from a hole in the ground, but what you describe is exactly what happens on (say) a Uno.
On power up or reset, the sketch starts running. The setup() function runs once, and once only, so stick your beeper in there. That's pretty much the purpose of setup().
JimboZA:
I don't know an Arduino101 from a hole in the ground, but what you describe is exactly what happens on (say) a Uno.
On power up or reset, the sketch starts running. The setup() function runs once, and once only, so stick your beeper in there. That's pretty much the purpose of setup().
The problem is that an Arduino takes 5 seconds to start the setup function, so I don't want it to beep 5 seconds after its reset, I want to know when it's reset
tayler6000:
The problem is that an Arduino takes 5 seconds to start the setup function, so I don't want it to beep 5 seconds after its reset, I want to know when it's reset
My UNO and Mega2560 boards both take less than 1 second, from releasing the reset button, to printing "Hello" on the serial monitor. (Optiboot bootloader) Dunno where you get 5 seconds from. (Edit: I guess the 101 must be slow-booting.) Just how fast does it really need to be?
You could do away with the bootloader and use ISP programming, then there'd be no delay.
With the UNO at least.
The 101 does take a lot longer than an uno to reboot. When you download the 101, it takes 5 seconds to reboot and then another before the serial monitor will work. If you switch to an Uno, you will not see that delay.
What about using a different button to start your script. Make the code wait in an infinite loop in setup() until you press that button. Then it will start running the code in the loop() function instantly.
No, it is not possible to run a script WHEN you press the Reset button. That action stops all activity and causes your Arduino to reboot. You can get it to beep during or after the reboot, as has been pointed out by others.