Added example_simple.py
This commit is contained in:
parent
da4b738b45
commit
a6eb50dce2
23
example_simple.py
Normal file
23
example_simple.py
Normal file
@ -0,0 +1,23 @@
|
||||
from lcdMenu import lcdMenu
|
||||
|
||||
prev_btn = Pin(13, Pin.IN, Pin.PULL_DOWN) # input of the first btn
|
||||
next_btn = Pin(14, Pin.IN, Pin.PULL_DOWN) # input of the second btn
|
||||
ok_btn = Pin(15, Pin.IN, Pin.PULL_DOWN) # input of switch
|
||||
|
||||
LCD = I2C_LCD(I2C(0, sda=Pin(8), scl=Pin(9), freq=400000),0x27,2, 16)
|
||||
|
||||
def first_callback():
|
||||
print("first_callback() called!")
|
||||
def second_cb():
|
||||
print("second_cb() called")
|
||||
def third_cb():
|
||||
print("third_cb() called")
|
||||
return True
|
||||
|
||||
|
||||
menuItems = [("first item", first_callback),
|
||||
("second item", second_cb),
|
||||
("third item", third_cb)]
|
||||
menu = lcdMenu(LCD, {"prev_btn":prev_btn, "next_btn": next_btn, "ok_btn": ok_btn}, menuItems, scroll_direction=False, cycle=False, hide_menu_name=True, name="Fullscreen!")
|
||||
|
||||
menu.run()
|
Loading…
Reference in New Issue
Block a user