fixed gpio init
This commit is contained in:
parent
2f9b1894d8
commit
33cd2c553c
8
main.py
8
main.py
@ -71,7 +71,6 @@ now = 0
|
|||||||
last_toggle = 0
|
last_toggle = 0
|
||||||
current_mode = NORMAL
|
current_mode = NORMAL
|
||||||
autostop = True
|
autostop = True
|
||||||
timer0 = Timer(0, mode=Timer.PERIODIC, )
|
|
||||||
|
|
||||||
def ypt(ts):
|
def ypt(ts):
|
||||||
# Bolt insertion rate in cm/s: y'(t)
|
# Bolt insertion rate in cm/s: y'(t)
|
||||||
@ -138,8 +137,7 @@ def setup():
|
|||||||
setup_gpio()
|
setup_gpio()
|
||||||
setup_timer()
|
setup_timer()
|
||||||
|
|
||||||
buttonUp = Pin(MODE_PIN)
|
if not MODE_PIN.value():
|
||||||
if not buttonUp:
|
|
||||||
print("Manual REWIND")
|
print("Manual REWIND")
|
||||||
autostop = False
|
autostop = False
|
||||||
current_mode = REWINDING
|
current_mode = REWINDING
|
||||||
@ -154,8 +152,8 @@ def setup_timer():
|
|||||||
|
|
||||||
|
|
||||||
def setup_gpio():
|
def setup_gpio():
|
||||||
#all_pins_off()
|
all_pins_off()
|
||||||
MODE_PIN.irq(trigger=Pin.IRQ_FALLING, handler=toggle_mode)
|
MODE_PIN.irq(trigger=Pin.IRQ_LOW_LEVEL, handler=toggle_mode)
|
||||||
|
|
||||||
|
|
||||||
def all_pins_off(pin):
|
def all_pins_off(pin):
|
||||||
|
Loading…
Reference in New Issue
Block a user