Public projects 1

Adjustable Countdown Timer

Project tutorial by dmytrosavchuk

  • 30 respects

Toolbox 3

Respected projects 2

One Kitchen Timer To Cook It All

Project showcase by ElBanquo

  • 21 respects

Automated Lego Shooter

Project tutorial by ShreyanR

  • 9 respects

  • Adjustable Countdown Timer 4 days ago

    Thanks for good words! The part of the code responsible for the delay before the quick changing of the countdown begins is in the reset() function. It is rather simple. First, I set up 2 variables, pressed3 and pressed4, that will contain information on how long you pressed - or + buttons respectively. The initial value for both is 0. Then in a while loop I show the current initial time and check if any of the buttons are pressed. For example, if I press "-" button, so that digitalRead(button3)==LOW is true, at the first iteration of the loop, when pressed3 is 0, the program will reduce the initial time by 1 (the line countdown_time -= 1) and increase pressed3 by 1. While you keep pressing the button, nothing else will change during the next 29 iterations of the loop. Only when pressed3 gets to 30, the countdown time will be reduced by 1 with each iteration of the loop. I hope this gives an idea. If you remove this "grace period", it will be very hard to set up the timer to the desired number as the numbers will change really fast. On the other hand, if you insert artificial delays, it will be very long to adjust it so some given number. Let me know if something should be expanded.

  • Adjustable Countdown Timer 11 days ago

    If you reset the whole program it will also erase the last initial value of the timer and will set it to 60 again, I guess. So it will be less convenient to use the timer in practice if you need to time identical time intervals several times.

  • Adjustable Countdown Timer 14 days ago

    I did not install it manually and "#include <math.h>" was enough for me. What chip do you have? There are some limitations according to
    They also have a reference to avr-libc library that probably can be installed if math.h is not found automatically.
    I only use that library for a function pow to compute 10^i, which may be an overkill. If installing a library does not work, you can add the following function:

    int pow10(int n) {
    int x=1;
    for(int i=0; i<n; i++) {
    x *= 10;
    return x;

    and then replace pow(10, 3-i) by pow10(3-i) in the code, and remove "#include <math.h>". This is generally not the most efficient way to compute powers, but since we only need it for i<4, it will work fine. I think it should work, but I did not test it myself since I disassembled the project. Let me know if it does not help.

Add projectSign up / Login