# turning sengment on one after another
# Write a micropython script to turn the seven segments a-g one after another with
# the rate of 1 second and to turn off the segments with the rate of 2 seconds repeatedly
from machine import Pin
import time
a = Pin(32, Pin.OUT)
b = Pin(33, Pin.OUT)
c = Pin(25, Pin.OUT)
d = Pin(26, Pin.OUT)
e = Pin(27, Pin.OUT)
f = Pin(14, Pin.OUT)
g = Pin(12, Pin.OUT)
def turn_on(segment):
segment.value(1)
def turn_off(segment):
segment.value(0)
while True:
turn_on(a)
time.sleep(1)
turn_on(b)
time.sleep(1)
turn_on(c)
time.sleep(1)
turn_on(d)
time.sleep(1)
turn_on(e)
time.sleep(1)
turn_on(f)
time.sleep(1)
turn_on(g)
time.sleep(2)
turn_off(a)
time.sleep(2)
turn_off(b)
time.sleep(2)
turn_off(c)
time.sleep(2)
turn_off(d)
time.sleep(2)
turn_off(e)
time.sleep(2)
turn_off(f)
time.sleep(2)
turn_off(g)
time.sleep(2)