from machine import Pin
from gpio_lcd import GpioLcd
import time
count1 = 0
count2 = 0
count3 = 0
lcd = GpioLcd(rs_pin=Pin(16),
enable_pin=Pin(17),
d4_pin=Pin(18),
d5_pin=Pin(19),
d6_pin=Pin(20),
d7_pin=Pin(21),
num_lines=2,
num_columns=16
)
button1 = Pin(0,Pin.IN,Pin.PULL_DOWN)
button2 = Pin(1,Pin.IN,Pin.PULL_DOWN)
button3 = Pin(2,Pin.IN,Pin.PULL_DOWN)
lcd.move_to(0,0)
lcd.putstr("HAPPY")
lcd.move_to(6,0)
lcd.putstr("BORED")
lcd.move_to(12,0)
lcd.putstr("SAD")
while 1:
lcd.move_to(1,1)
x = button1.value()
y = button2.value()
z = button3.value()
if(x==1):
count1 = count1 + 1
lcd.putstr(str(count1))
time.sleep(1)
if(y==1):
count2 = count2 + 1
lcd.move_to(7,1)
lcd.putstr(str(count2))
time.sleep(1)
if(z==1):
count3 = count3 + 1
lcd.move_to(13,1)
lcd.putstr(str(count3))
time.sleep(1)