I’ve gotten Scratch up and running based on all of the info on the site and forums via VNC and SSH, but can’t get the motors to work in the motor test or car programs. Any ideas on how to troubleshoot? I’ve verified the ports and checked other obvious issues, but am stumped. Any ideas?
rcmcdonald, a quick question for you:
Are you able to get any of the sensor examples to work? Or just problems with the motors?
And just to double-check, are you running
sudo python BrickPiScratch.py ? (If you are, is it kicking back any errors?)
- ran through the getting started
- launched scratch
- enabled remote sensor connection
- launched sudo python BrickPiScratch.py
- Opened motor test example
- Motors are connected to MA and MD - can control both with broadcast join ‘MA’ ‘E’ and broadcast join ‘MD’ 'E;. And can stop both motors with broadcast join ‘MA’ ‘D’ and broadcast join ‘MD’ ‘D’
- Trouble: how do I set different speed and direction, tried broadcast join ‘MA’ ‘-128’ and ‘MD’ ‘-256’: the motor does spin at all. E.g. for turning I need to spin motors at different speed and for turn on the spot I need to spin motors in opposite directions.
Hey vladimir, you’ll need to use a change variable block, and change the variable “speed”. If you check out this article,
on Page 15 you’ll see how speeds are increased and decreased.
It sounds like you might be using a number, not a variable? Maybe you can try using a variable (speed) instead?
I have got a motor running using the scratch example, but [ an I accept I a probably just being stupid] can someone direct me to a list of the motor commands as this is not in the MagPi artical as far as I can see ?
More generally I do feel some more instructions would be helpful that explained things rather than just do this or that - these may he sitting on the site somewhere but I cannot see find them
Hey DavidMS, there really aren’t many more commands for motors in Scratch. Can you give me an idea of what you’re looking for?
The most extensive walk through we have is here:
Maybe it’s not what you’re looking for? We would really appreciate advice on how to improve it, if this doesn’t solve your question.
I just started with the BrickPi. Maybe a stupid question, but I can’t get the scratch examples to work for the motor or car.
Read through the forum, and I am able to run the python motor example (LEGO-Motor-Test.py).
Did the following:
- Click on BrickPi_Scratch_Start icon --> terminal screen appears (remains blank)
- Open Scratch
- Open example Cars
Get back the message "Remote Sensors enabled"
However no response from motor A or B.
After a while the terminal throws
"Scratch connection error, Retrying"
“Scatch is not connected or remote sensors aren’t enabled”
Any idea what I am doing wrong?
Here is the sequence for using Scratch, and it sounds like you may be missing a step. (I was when I started.)
- Start Scratch, and load your program
- Under Sensing, right-click on the question mark under sensor: <sensor[button_pressed] ?>
- Now open a terminal window, and cd to the BrickPi_Scratch directory
- Do the following command: sudo python BrickPiScratch.py
- Now you can minimize the terminal window, go back to Scratch and it should work.
You need to do this sequence every time (for every program, if I remember correctly).
Thank you for the prompt reply.
Sorry to keep bothering you with my beginner problems, however I tried to follow your instructions, but I am still unsuccesful.
Could be I am not 100% sure what you mean by right clicking the question mark.
It gives me a pop up menu with
- Show ScratchBoard watcher
- Disable remote sensor connections.
I tried disabling the remote sensor connections, then start BrickPi_Scratch.py, and enabled the connections again.
Also tried not to do anything,and the start BrickPi_Scratch.py.
Unfortunately neither of the above seemed to work for me.
Might be missing something obvious? (I am supposed to press the green flag to start the Scratch code, right?)
All python examples are working…
(same problem with 2014.13_DI_USB.img)
Its been a while so I went and tried it again tonight. When I loaded the motor test example program a message popped up saying the remote sensing was enabled. The very first time I started Scratch this did not happen, but by right-clicking on the “?” indicated I could enable remote sensing. So if on right-click it says for you, as it does for me, disable remote sensor connections, then you are already connected and don’t need this step.
So when you type the “sudo” command in the terminal window, do you get the following messages?
“Connected to Scratch successfully”
“Setting up sensors done”
And then the cursor should just hang there and not return to a prompt, indicating that the program is running.
If you get that as well, then when you return to the Scratch window, if you have a motor connected to the port MA, press the green flag and then up arrow will start the motor running, and left and right arrows will change its speed.
That’s about all the help I can give, since I haven’t done much more than that with it.
Thanks for all the help.
I followed all your tips, and also found some examples on youtube, which are in line with your suggestions.
Problem is that, even if I start everything as sudo, and tired every possible order, I never get the message “Connected to Scratch successfully” (while I do get the “remote sensors enabled” message).
As mentioned everything else works with when running the python examples, so I have no further clue what to do.
Hope the DexterIndustry guys have a solution.
If the python is working and able to run motors, it’s most likely not a hardware problem. This is good news.
Turning to the Scratch software: what are you using for an SD card? What, where, and when did you get? This should help us in troubleshooting the issue.