# BBC micro:bit Counter using a 7-Segment Display

The aim of this challenge is to create a countdown timer, controlled by a BBC micro:bit that will display the numbers on a 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.)

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:

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 1 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 1 1 1 0 0 1 0 1 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1

#### Step 1: The electronic circuit

To complete this challenge you will need:

• 8 resistors of 220Ω each
• 1 7-segment display (common anode)
• 1 BBC micro:bit
• 1 micro:bit edge connector
• 20 wires

Here is the circuit that you will need to re-create:

#### Step 2: Python Code

To program your BBC micro:bit you will use the Python editor and copy and paste the following code:

Your 7-segment display should display all the digits, counting up from 0 to 9.