from machine import Pin, ADC
from time import sleep
pin1 =Pin(5, Pin.OUT) #D1
pin2 = Pin(4, Pin.OUT) #D2
pin3 = Pin(0, Pin.OUT) #D3
pin4 = Pin(2, Pin.OUT) #D4
pin1.off()
pin2.off()
pin3.off()
pin4.off()
adc = ADC(0)
def step (delate):
pin1.on()
pin2.on()
pin3.off()
pin4.off()
sleep(delate)
pin1.off()
pin2.on()
pin3.on()
pin4.off()
sleep(delate)
pin1.off()
pin2.off()
pin3.on()
pin4.on()
sleep(delate)
pin1.on()
pin2.off()
pin3.off()
pin4.on()
sleep(delate)
while True:
a = adc.read()
a = a * 1/(1024*10)
if a <= 0.02:
a = 0.02
step(a)