this is in mu
from gpiozero import Robot
robby = Robot(left=(7,8), right=(9,10))
this is in the Raspberry Pi terminal
python robby.forward()
# Then it says ‘robby’ is to defined, I don’t know why it says that. I defined ‘robby’ in the mu command. The motors and motor board are clearly working, just not the code.
-
Quick Question: Are you using Circuit Python? If you are using Rpi python. perhaps you can use Thonny IDE instead of Mu, then I can repeat you problem on my side. And please give the full listing of your code, if possible. Or give us the link of your tutorial. – tlfong01 21 hours ago
-
You might like to search this forum using key words “L298N” to find many posts on buddies and robbies. Here is one: raspberrypi.stackexchange.com/questions/104365/…. I also answered a couples of questions on Gpio.Zero. But I usually recommend newbies to first try Rpi.Gpio, then Gpio.Zero. – tlfong01 21 hours ago
-
This another answer of mine with references to Gpio.Zero: raspberrypi.stackexchange.com/questions/98513/…. – tlfong01 21 hours ago
-
1I am just using the “Build a robot buggy” project on the raspberry pi website. In their instructions they use gpiozero so that’s what I used. – Aysmith17 21 hours ago
-
1projects.raspberrypi.org/en/projects/build-a-buggy – Aysmith17 21 hours ago
Answer
(1) The “Buid a buggy” instructions is not clear.
I got the same error as the OP.
What the OP can do is the “Yellow Block” below.
(2) I looked at the instructions again and found that perhaps they are for Rpi3B+ IDLE python 3.5.3. I vaguely remember that for IDLE 3.5.3, the IDE is divided into two separate windows, left window is text terminal output, right window is for IDLE editing/compile/run.
What confuses the OP further is that the Mu editor saves python script files by default in the directory home/MuCode/, but IDLE would save files in another default directory.
/ to continue, …
References
(1) Build a robot buggy, Basic Instructions – Projects.RaspberryPi.Org
(2) Build a robot buggy, Assemble and Make a Lipo Power Bank
(3) Robby to go in a square, a circle, and zigzag
(4) GpioZero 1.5.1 Section 16.1.15. Robot classgpiozero.Robot()
Categories: Uncategorized