from machine import PWM,Pin
from time import sleep
from servo import Servo
from encoder import RotaryEncoder
servo1 = Servo(12)
servo2 = Servo(14)
def rotation_handler(direction):
if direction == RotaryEncoder.ROT_CW:
servo1.rotate(9)
servo2.rotate(-9)
else:
servo1.rotate(-9)
servo2.rotate(9)
myEncoder = RotaryEncoder(26,27,rotation_handler)
def main():
sleep(0.1)
print("Hello, ESP32!")
if __name__ == '__main__':
while True:
main()