Hello, everyone!
First time poster here so I apologize if this is in the wrong section.
I am currently working on a timer/counter project on my Arduino Uno (Elegoo version). I am using a 5641AS 4 Digit 7 Segment display to show the numbers. Most of the project is working but I am having trouble displaying multiple and different numbers at the same time. My goal at the moment is to count from 0 to a specified end number and have all the required digits to display on the 7 segment.
I created a function that power combinations of segments that will create the numbers, 0-9. To select the correct digit position (first digit, second digit, etc), I created a function that will turn on a certain digit position (LOW signal to pin) and the other three off (HIGH signal to pin).
The main algorithm involves dividing the current time/value into its digits which are then stored into its respective variable. What I am having trouble with is displaying all 4 digits of a number like 1234 at the same time. After the 1234 is separated into its digits, a call the function that selects the correct digit position and then the function that lights the correct segments to form a number. For example, to display the first digit of 1234, the left most digit position is selected and then the segments for number 1 are lit up. This goes on until all the digits of 1234 are displayed.
The problem is that the 7 segment is simply "sweeping" through the digits extremely fast. The first digit would light up, turn off, second digit would light up, turn off, third digit would light up, turn off, fourth digit would light up then turn off. I can't seem to find a way to display all digits at the same time without using a delay to turn on and off each digit individually and then moving on to the next. What I want is to display all digits of 1234 at the same time, wait a delay of 1 second, display 1235 and so on. If I don't turn off the first digit position before trying to display the following digits, 4 digits are displayed at the same time without the sweeping effect but they are all the same number.
Sorry for the long post but if anyone can provide any help that would be greatly appreciated. Thank you!
I am using Visual Studio Code instead of the Arduino IDE and have posted a link to my code on pastebin. (#include <Arduino.h>//Arduino Pins for Segments int A=2; //BCD pin 11int - Pastebin.com)
Video of it running Imgur: The magic of the Internet
7 Segment.txt (4.98 KB)