I want to make simple menu with rotary pcd8544 esp32.
I tried some but didn't work
When I use interrupt and interrupt to assign another function, it resets esp32 with machine.disable_irq().
how can i make a simple menu with submenu
Code: Select all
from rotary_irq_esp import RotaryIRQ
import pcd8544_fb
import time
import utime as time
from machine import Pin, SPI
r = RotaryIRQ(pin_num_clk=35,
pin_num_dt=34,
min_val=0,
max_val=4,
reverse=False,
range_mode=RotaryIRQ.RANGE_WRAP)
button = Pin(39, Pin.IN)
spi = SPI(1)
spi.init(baudrate=2000000, polarity=0, phase=0)
cs = Pin(15)
dc = Pin(4)
rst = Pin(27)
lcd = pcd8544_fb.PCD8544_FB(spi, cs, dc, rst)
while True:
rot=r.value()
if rot == 0:
lcd.fill(0)
lcd.text("> HIZ ",0,0,1)
lcd.text(" START AYAR",0,8,1)
lcd.text(" STOP AYAR ",0,16,1)
lcd.text(" AYARLAR ",0,24,1)
lcd.text(" KODLAMA ",0,32,1)
lcd.show()
if button.value() == 0 and button_old == 1:
lcd.fill(0)
lcd.text("----HIZ-----",0,0,1)
lcd.text(" ",0,8,1)
lcd.text(" ",0,16,1)
lcd.text(" ",0,24,1)
lcd.text(" ",0,32,1)
lcd.show()