Saturday, 3 June 2023

Motor direction 2

from machine import Pin import utime in1=Pin(15,Pin.OUT)#purple in2=Pin(14,Pin.OUT)#blue in3=Pin(17,Pin.OUT)#white in4=Pin(16,Pin.OUT)#green while True: print('Not turning') in1.value(0) in2.value(0) in3.value(0) in4.value(0) utime.sleep(5) #wheel spin towards motor controller L298N print('forward direction') in1.value(0) in2.value(1) in3.value(0) in4.value(1) utime.sleep(5) print('Not turning') in1.value(1) in2.value(1) in3.value(1) in4.value(1) utime.sleep(5) #wheel spin away from motor controller L298N print('backward direction') in1.value(1) in2.value(0) in3.value(1) in4.value(0) utime.sleep(5) #https://www.youtube.com/watch?v=dRXJAFPhKTY&list=PLgFwxqENEmX_8kdXEFYdETEqB4PPkMyc0&index=11

No comments: