I purchased a button seen here to connect to the arduino uno
http://www.miniinthebox.com/octopus...rks-with-official-arduino-boards_p824623.html
Once the button is installed, I want to press the button once and have the program (stepper motor spin) cycle through. I don't want to have to hold the button in order for the program cycle to complete.
I have the basic sample of the code, but not sure what to enter
Thanks in advance for any help.
Moderators note : Used code tags for C
http://www.miniinthebox.com/octopus...rks-with-official-arduino-boards_p824623.html
Once the button is installed, I want to press the button once and have the program (stepper motor spin) cycle through. I don't want to have to hold the button in order for the program cycle to complete.
I have the basic sample of the code, but not sure what to enter
C:
void loop() {
if(doing_stuff) {
do my loop thing;
if(my loop thing is finished) {
doing_stuff = false;
}
}
else {
if(button is down) {
doing_stuff = true;
}
}
}
Moderators note : Used code tags for C
Last edited by a moderator: