Hi, I am doing a school project and have never used arduino before. I am trying to create a timer, where I push the button a certain number of times to trigger a count down, based on how much time I need (press once for two minutes, twice for 3 minutes, three times for 4 minutes). After the light is triggered, I would like it to stay lit. When the countdown is close to zero, I want the light to blink. When it reaches zero, I would like the LED to turn off. My professor is not helping me or teaching anything about this so any help would be much appreciated starting with whether or not the concept is even feasible. I have little coding knowledge as well. Thanks
It can be done , have a look at the IDE examples to get an understanding of inputs and outputs , denouncing inputs etc; part of the exercise is to learn coding is my guess.
You can decrement a counter ( count =count -1) with each button press and when the value is one blink your led
starting with whether or not the concept is even feasible.
Yes, it is. It's not even terribly difficult. You just need to break the problem down into pieces that you can implement.
You mention pressing a button. I'll assume you really mean switch, as pressing a shirt button will have no effect. The state change detection example will show you how to determine that a switch has become pressed, as opposed to is pressed.
You can set a time to count down to 0. Each time the switch becomes pressed, increment that value by whatever amount is appropriate.
The blink without delay example shows how to use millis(). Each time through loop() you can compare the current time (obtained using millis()) to the last time you decremented the time to count down variable. If it has been long enough, reset the time and decrement the value again.
Using an if statement or two, you can determine if the LED should be on steady, blinking, or off. If the LED should be on, but isn't, turn it on. If time has run out (time to count down has reached 0) turn the LED off. If the time is low, blink the LED, using the blink without delay technique, NOT delay().
If you have problems, post what you have, explain what it actually does, and how that differs from what you want.