Hello,
I spent a great deal of time today trying to modify my previous code to get it to work with picozero. I got very tired of that, so I ripped it down and started again. I confirm that both the sensor and motors/motor controller are working and I have even written programs to exercise them both. However when I tried to marry the two in my mark 2 code.....nothing. lol. Below is the code and I'm sure I'm missing something but I'm not sure what.
I spent a great deal of time today trying to modify my previous code to get it to work with picozero. I got very tired of that, so I ripped it down and started again. I confirm that both the sensor and motors/motor controller are working and I have even written programs to exercise them both. However when I tried to marry the two in my mark 2 code.....nothing. lol. Below is the code and I'm sure I'm missing something but I'm not sure what.
Code:
from picozero import Robotfrom time import sleepfrom machine import pinir_sensor_pin= 16 robot_rover = Robot(left=(18,19), right=(20,21))ir_sensor_pin = Pin(16, Pin.IN)def robot_rover stop(): robot_rover.stop() def robot_rover forward(): robot_rover.forward() def robot_rover left(): robot_rover.left() def robot_rover right(): robot_rover.right() while True: if ir_sensor_pin.value() == 0: robot_rover.stop() else: robot_rover.forward() time.sleep(0.1)
Statistics: Posted by Jweld1117 — Fri Oct 18, 2024 8:39 pm — Replies 2 — Views 39