Fixes missing import and botched refactoring

reported by robert-hh
pull/6894/head
Sandor Attila Gerendi 2021-12-28 12:01:48 +02:00 zatwierdzone przez GitHub
rodzic 564fafd6d5
commit 5366ead756
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -9,6 +9,7 @@ https://electronics.stackexchange.com/questions/360637/quadrature-encoder-most-e
"""
from machine import Pin
import rp2
from rp2 import PIO, StateMachine
import utime
import array
@ -89,7 +90,7 @@ def pio_quadrature(in_init=rp2.PIO.IN_LOW):
sm = StateMachine(0, pio_quad, freq=160000, in_base=Pin(2))
sm = StateMachine(0, pio_quadrature, freq=160000, in_base=Pin(2))
sm.irq(encoder_state_changed_irq_handler)
sm.exec("set(y, 99)") # add a last value for y that would be always different then the input
sm.active(1)