[SOLVED] 4-digit 7 Segment display showing 4 digit number 1 digit at a time

I have a 4-digit 7 segment display, and when I change the number using .setNumber()

Here is my code:

void loop() {

With the code above, it goes from 1 _ _ _ to _ 0 _ _ to _ _ 0 _ and so on.

How can I make it so that every 500 milliseconds it will set the display to read 1000?

Here's the code for the display:

#include "SevSeg.h"

SevSeg sevseg;

void setup() {

  byte numDigits = 4;
  byte digitPins[] = {10, 11, 12, 13};
  byte segmentPins[] = {9, 2, 3, 5, 6, 8, 7, 4};

  bool resistorsOnSegments = true; 
  bool updateWithDelaysIn = true;
  byte hardwareConfig = COMMON_CATHODE; 
  sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments);


I use the example of a constant int for simplicity, I would like to have a number that changes over time, hence the use of delay(500). So for example, it would go from 1000 to 0999 in 500 milliseconds.

Not enough information. Please read and follow the instructions in the "How to use this forum" post.

Always post ALL the code; post links to libraries and devices.

It's pretty simple, really. Just remove the delay(500);

The delay is there because I want to eventually change the number over time.

Too bad. the SevSeg library won't work with delays in loop(). You have to use millis() for timing. You should always look at the example sketches that ship with a library:

Oh ok thanks I'll try that

Try the following:

void loop() 
   unsigned long prMillis = millis();
   while(millis() - prMillis <500)
  // delay(500);

Thank you, that worked!