Hey everyone,
I am currently working on a countdowntimer on a 4x7 segment led display. Im using the SevSeg.h libary and i run into a few problems. Im trying to update the time every second but this slows down the refresh rate. Is there a way of refreshing the time while still updating the display with a delay(1)?
Or is there a way of shifting the digits to not show the last digit? i dont need the 0.001 second but i cant make the timer bigger (like 10000) because it would be too big to display.
(by the way: the code is far from optimal and Im quite new to the libary)
Please read the instructions and have a go at posting the code so we can examine it easily on the Web page.
Multiplexing a display in code is possible but there are problems with how much current you can drive to the display with the circuit you have not revealed, and you sould really consider it an "educational" exercise only and not something you would use for a serious application. You would use one of those nice MAX7219 display modules or even a TM1637 module.
Is there a way of refreshing the time while still updating the display with a delay(1)?
I've not read your code so I might have misunderstood, there is no need to update a display as often as every millisecond because no human can read 1000 display updates in 1 second. Normally you need to update a display once per change, and not more than about 10 times per second for most purposes.
You need to get away from using delay for anything, have a look at: Using millis for timing Demonstration for several things at the same time
In answer to the question "my code is not very responsive and I don't know why", which you will be asking in a month or 3; "It's because of all the delays".
PerryBebbington:
I've not read your code so I might have misunderstood, there is no need to update a display as often as every millisecond because no human can read 1000 display updates in 1 second. Normally you need to update a display once per change, and not more than about 10 times per second for most purposes.
Hang on now!
The OP here is using the "SevSeg" library to multiplex a 4 digit LED display. This requires continuous updates at a rate of more than 100 per second to swap from digit to digit with a library call. You need four calls to show all four digits within a POV interval and you need these to be at a reasonably predictable interval to ensure uniform brightness, so using millis() to schedule the calls every five milliseconds would for example be a reasonable approach.
Whether the actual display data changes in the meantime is less of a concern except if it blurs the display.