this is in mu
from gpiozero import Robot
robby = Robot(left=(7,8), right=(9,10))
this is in the Raspberry Pi terminal
# 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 Apr 25 at 3:35
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 Apr 25 at 3:41
This another answer of mine with references to Gpio.Zero: raspberrypi.stackexchange.com/questions/98513/…. – tlfong01 Apr 25 at 3:46
And please confirm if your code is as updated as the following GpioZero Version 1.5.1 Section 16.1.15: gpiozero.readthedocs.io/en/stable/api_boards.html#robot. – tlfong01 Apr 25 at 3:49
Beside Rpi.StackExchange Q&A, you might also search the GpioZero L298N discussions on Rpi.Org.Forum. Here is one example: raspberrypi.org/forums/…. – tlfong01 Apr 25 at 3:54
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 Apr 25 at 4:05
1projects.raspberrypi.org/en/projects/build-a-buggy – Aysmith17 Apr 25 at 4:08
Ah, you are using the “official” tutorial to build a L298N buggy/robby. My Mu experience with Mu editor is using MicroPython with PyBoard and MicroBit BBC Micro. I do notice recent Rpi buster has Mu installed, but I only played with IDLE before and Thnooy new. Perhaps I should starting learning Mu and see if I can understand your situation. – tlfong01 Apr 25 at 4:24
Just now I follow the tutorial and got the same error as you. I found that the instruction to run the program robby.py is PLAIN WRONG! You might see in my quick answer below what are the correct steps to move the motor. Ah, it is lunch time! I need to eat my locking down meal (while listening to a locking down song) youtube.com/watch?v=LNNPNweSbp8now. Perhaps I should explain later. Cheers. – tlfong01 Apr 25 at 4:59
1I put the code in that you showed and it made no errors. However, the motor did not move. I suppose there’s something wrong with the motor board and how it is wired to the pi. But thanks for your help and I hope you enjoyed your locking down meal and song. – Aysmith17 yesterday
You are welcome. As your question is not very clear and so now is closed and currently not accepting any new answers. (I assume you can still read my old answer. Please let me know otherwise.) I have enough reputation points to EDIT THE QUESTION FOR YOU. Usually I would ask the the OP (Original Poster, ie you) to authorize me to do so, otherwise my broken English would damage your reputation. It is easy for me to copy part of my answers to your question to clarify things, and hopefully the question can be reopened tor me and others give more answers.. No hurry though. Take your time to reply. – tlfong01 yesterday
Hi @Aysmith17, Anyway, you have solved your problem of “Robby’ is not defined”. Now you new problem is that “Motor not moving”. For this general problem, you can search the forum for L298N where I made a couple of answers. / to continue, … – tlfong01 3 mins ago Edit
An example is the following question also using Gpio.Zero: (1) “Rpi GPIOzero L298N DC Motor Driver Problem, Rpi.stackexchange – thecanmanisback 2019jun10”: raspberrypi.stackexchange.com/questions/99460/…. The OP starts with the following statement and his motor is moving: from gpiozero import Robot robby = Robot(left=(7,8), right=(9,10)). Perhaps you can move on to that question, and see if that solves your problem. You can ask me again, addressing to @tlfong01, so that I can readily notified. Good luck! – tlfong01 32 secs ago Edit
(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, …
(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()