import utime
#checar VisualPolitik
import machine
from machine import I2C
from lcd_api import LcdApi
from pico_lcd_api import I2cLcd
I2C_ADDR = 0x27
I2C_NUM_ROWS = 4
I2C_NUM_COLS = 20
def test_main():
#Test function for verifying basic functionality
print("Running test_main")
i2c = I2C(0, sda=machine.Pin(0), scl=machine.Pin(1), freq=400000)
lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
lcd.putstr("It Works!")
utime.sleep(2)
lcd.clear()
count = 0
b1 = Pin(16, Pin.IN, Pin.PULL_UP)
b2 = Pin(17, Pin.IN, Pin.PULL_UP)
def fun_b1(b1):
global count
count = count + 1
if count == 100:
count = 0
lcd.cursor(6, 1)
lcd.putstr("{:04}",format(count))
b1.irq(trigger = Pin.IRQ_FALLING, handler =fun_b1 )
b2.irq(trigger = Pin.IRQ_FALLING, handler =fun_b1 )
while True:
pass