Back

Comments 9

  • Adjustable Countdown Timer 20 days ago

    Thanks for good words! Did you try to use analog pins instead? If it will not work for the buttons, you can probably use them for segments to free up some digital pins. One of them is analog anyway, so it should work, I guess. For example, you can assign "int segF = A1;" and use digital pin 7 for the reset button. If this does not work, you can simply use pin 6 that currently corresponds to the first digit of the display. Then the countdown will be limited to 999, but still gives you something. Then you would need to change the first line of SwitchDigit function to "for (int i=1; i<4; i++) {"

  • Adjustable Countdown Timer 23 days ago

    I did not try it personally but I think that it should work. I did not use any functionality specific to MEGA only.

  • Adjustable Countdown Timer 27 days ago

    I think I saw something like that in my project as well but did not pay attention since it was really faint. It looks like it may be caused either by imperfections in the display itself or by some loose connections.

  • Adjustable Countdown Timer about 1 month ago

    This is strange - it shouldn't. At least this was not happening in my case as you can see in the video. Can you check your wiring? Maybe this is hardware problem? Also, does it light up in a full brightness or is really faint?

  • Adjustable Countdown Timer about 1 month 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 about 1 month 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 about 2 months 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 https://www.arduino.cc/en/math/h
    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.

  • Adjustable Countdown Timer about 2 months ago

    I do not have Arduino Due, so I am not sure, but I don't see any particular problems. The project does not use anything specific to Mega. You only need digital and analog pins.

  • Adjustable Countdown Timer about 2 months ago

    Thanks! I just wanted to do a countdown timer a bit more practical and was not able to find anything what I had in mind online. It seems natural that adjusting a timer is an important functionality that has to be convenient.

Add projectSign up / Login