Countdown

countdown_animatedThe aim of this blog post is to create a countdown timer that will display the numbers on screen using a 7-segment display. A lot of electronic devices use this approach to display numbers on a LED or LCD screen. (Watch, alarm clock, calculator etc.)

First we need to investigate how the 7-segment display works. You will find this page quite useful.

Typically 7-segment displays consist of seven individual coloured LED’s (called the segments). Each segment can be turned on or off to create a unique pattern/combination. Each segment is identified using a letter between A to G as follows:

7segments

The following truth table shows which segments need to be on to display the digits from 0 to 9:

Digit A B C D E F G
tmp-0 1 1 1 1 1 1 0
tmp-1 0 1 1 0 0 0 0
tmp-2 1 1 0 1 1 0 1
tmp-3 1 1 1 1 0 0 1
tmp-4 0 1 1 0 0 1 1
tmp-5 1 0 1 1 0 1 1
tmp-6 1 0 1 1 1 1 1
tmp-7 1 1 1 0 0 0 0
tmp-8 1 1 1 1 1 1 1
tmp-9 1 1 1 1 0 1 1

Your Challenge

The code below is used to display a countdown timer counting from 5 to 0 and using the 7-segment approach to display the numbers.

Your challenge consists of using the truth table given in this post to start your countdown from 9 (instead of 5).

Challenge #2:


With 7 segments there are 128 possible symbols. Some can be used to represent letters. For instance:

tmp-10tmp-11tmp-12tmp-13tmp-14tmp-15

Tweak the code above to write a message using the 7-segment display.

Start with the following message “Hello” (HELLO)

Did you like this challenge?

Click on a star to rate it!

Average rating 2.3 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!