Hello people!
How could I have a system where if a button is pressed upon startup, it sets a value to True, and if the button was not pressed in that amount of time, the value is false?
Any help would be appreciated
Hello people!
How could I have a system where if a button is pressed upon startup, it sets a value to True, and if the button was not pressed in that amount of time, the value is false?
Any help would be appreciated
What value do you want it to have, before the button is pressed ?
Are you going to use this value for anything, before the specified time has elapsed ?
So, my project is a robot that mimics human movement, and the value sent to each of the flex sensors is output to serial, however sometimes I do not want to read that serial data, therefore in void setup() I want to have on option to omit that serial transmitting, and the user has 5 seconds to press the pushbutton. once the pushbutton has been pressed, the serial will be blank, however if the button was not pressed in that 5 seconds, the data will be sent
How long to you want to wait to test if the button will not be pressed?
Does the Arduino need to do something else during that period?
If nothing is to happen during the waiting period you can just have WHILE loop in setup() that waits for the time to elapse while checking the button pin. Use the millis() technique from several things at a time.
...R
Robin2:
How long to you want to wait to test if the button will not be pressed?
Does the Arduino need to do something else during that period?If nothing is to happen during the waiting period you can just have WHILE loop in setup() that waits for the time to elapse while checking the button pin.
...R
it does not need to do anything else and 5 minutes
thread closed: used while loop
PLease share your solution for future reference