Unique 7 Segment display help

Hello All,

I built a pair of seven segment displays using the WS2812B LEDs. Its very simple, just one LED per segment. What I am trying to do is make a counter that counts from 00 to 99. I am able to count from 0 to 9 but thats where I get stuck.

In my sketch, I am using a int counter=0 and just incrementing it with every button press. I created an if statement that checks the count and if it is = to 1, it will turn on the proper LEDs, if count = 2 it will turn on the LEDs to make a 2 and so on. I am not sure how to count higher than 9.

Can someone give me some ideas how to proceed?

Thanks

boB

If count >= 10, you split "count" in 2 digits (tens and units), then apply the same principle/function you used to light up one digit.

I'm not sure how to split count into two digits. Can you give me an example?

Thanks

boB

Hi, use / (division) and % (Modulo).

For example, 17:

17 / 10 = 1
17 % 10 = 7

Paul

Thanks Paul! That really helped, I didn't think of doing it like that.

boB

Just reporting back, using the /10 and /100 helped me separate the digits to each display.