from ssd1306 import SSD1306_I2C
from machine import Pin, I2C, Timer
from time import sleep

i2c = I2C(1, scl=Pin(7), sda=Pin(6), freq=200000)
oled = SSD1306_I2C(128, 64, i2c)

oled.fill(0)
oled.text("Hello,World!",0,0)
oled.show()

ledR = Pin(17, Pin.OUT)
ledB = Pin(25, Pin.OUT)
ledG = Pin(16, Pin.OUT)
Counter = 0

def fun(tim):
    global Counter
    Counter = Counter + 1
    ledR.value(Counter % 2)
    ledB.value(Counter % 2)
    ledG.value(Counter % 2)

tim = Timer(-1)
tim.init(period=1000, mode=Timer.PERIODIC, callback=fun)
