import time
from machine import PWM, ADC, Pin, RTC
# print("Hello WOrld")
# rtc= RTC()
# rtc.datetime((2024,2,2,6,11,35,0,0)) #get or set the current time
# print(rtc.datetime())
# print(time.tick_ms())
motor = PWM(Pin(0))
motor.freq(50)
verticle = ADC(26)
horizontal = ADC(27)
select = Pin(28,Pin.IN,Pin.PULL_DOWN)
position = 4500
while True:
if select.value()==1:
print("Clicked")
while verticle.read_u16()<32759 and position<4750:
position+=1
motor.duty_u16(position)
while verticle.read_u16()>32759 and position>1001:
position-=1
motor.duty_u16(position)
print(verticle.read_u16(),position)
time.sleep(1)