from machine import Pin
from time import sleep
ssd = [13,12,14,27,26,25,33]
data = [
[0,0,0,0,0,0,1],
[1,0,0,1,1,1,1],
[0,0,1,0,0,1,0],
[0,0,0,0,1,1,0],
[1,0,0,1,1,0,0],
[0,1,0,0,1,0,0],
[0,1,0,0,0,0,0],
[0,0,0,1,1,1,1],
[0,0,0,0,0,0,0],
[0,0,0,0,1,0,0]
]
for i in range(7):
Pin(ssd[i],Pin.OUT)
ir_sensor_pin = Pin(2, Pin.IN)
ir_sensor_pin2 = Pin(4, Pin.IN)
led_pin = Pin(15, Pin.OUT)
count=0
while True:
for i in range(7):
ssd[i].value(1)
if ir_sensor_pin.value() == 1:
print("one Person entered")
led_pin.on()
count+=1
if count>=9:
count=0
for i in range(7):
ssd[i].value(data[count][i])
elif ir_sensor_pin2.value() == 1:
print("One person left")
led_pin.on()
count-=1
if count<=0:
count=0
for i in range(7):
ssd[i].value(data[count][i])
sleep(0.5)