'''
AIM :
1) Seven segment display giving count from 9-0
2) Design a traffic system but whenever red to yellow
'''
from machine import Pin
import time
a = Pin(0, Pin.OUT)
b = Pin(1, Pin.OUT)
c = Pin(2, Pin.OUT)
d = Pin(3, Pin.OUT)
e = Pin(4, Pin.OUT)
f = Pin(5, Pin.OUT)
g = Pin(6, Pin.OUT)
segments = [a,b,c,d,e,f,g]
digits = {
9:[1,1,1,1,0,1,1],
8:[1,1,1,1,1,1,1],
7:[1,1,1,0,0,0,0],
6:[1,0,1,1,1,1,1],
5:[1,0,1,1,0,1,1],
4:[0,1,1,0,0,1,1],
3:[1,1,1,1,0,0,1],
2:[1,1,0,1,1,0,1],
1:[0,1,1,0,0,0,0],
0:[1,1,1,1,1,1,0]
}
while True:
for num in range(9,-1,-1):
pattern = digits[num]
for i in range(7):
segments[i].value(pattern[i])
time.sleep(1)