I have to control motors of my Braitenberg vehicle using robot class of gpiozero. Sometimes I have to turn my robot reverse direction either in left or right. But this thing is not happening. I am happy with forward motion of my robot. How can I solve the problem? My code for turning backward right look like:

from gpiozero import Robot
import time
robby = Robot(left = (7,8)) right = (9,10))
while True:
      robby.right(0.35) #increasing speed of right wheel to turn right


But sometimes the vehicle rotates since one wheel not rotating in forward or backward. Sometimes it goes forward. I don't know what is going on. How to control reverse movement and turning of robot with gpiozero?

  • You need to explain what happens and what you think should have happened. – joan Mar 12 at 18:16
  • 1
    Try opening a Python shell (python3 in the terminal or one of these: ipython, Mu's REPL, Thonny or IDLE's shell...) and typing the commands one-by one. When you type robby.forward() does it do what you expect? Try each of the other commands (left, right, backward, etc) and if something doesn't work as expected, try to explain what's wrong here. – ben_nuttall Mar 12 at 19:04
  • Thonny creates some internal errors while terminating program by clicking on red button. At that time the robot goes forward with full speed. Is there is any option for restart kernel as we scene on spyder ide? – Arun K S Mar 12 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.