from machine import Pin,I2C
import time,ssd1306
oled=ssd1306.SSD1306_I2C(128,64,I2C(0,scl=Pin(1),sda=Pin(0)))
r,g=Pin(15,Pin.OUT),Pin(14,Pin.OUT)
def show(msg,t):
oled.fill(0)
oled.text(msg,35,20)
oled.text("Time:{}".format(t),25,40)
oled.show()
def light(rv,gv,start,end,step,msg):
r.value(rv);g.value(gv)
for i in range(start,end,step):
show(msg,i)
time.sleep(1)
while True:
light(1,0,30,0,-1,"STOP")#RED
light(1,1,5,0,-1,"READY")#YELLOW(5s)
light(0,1,30,0,-1,"GO")#GREEN
light(1,1,5,0,-1,"READY")#YELLOW(5s)