Discuss Scratch

sxhat
New to Scratch
3 posts

Controlling two WeDo motors separately

Hello,
I am new to Scratch and WeDo. I am interested in controlling two WeDo motors separately. It appears that the ‘standard’ Scratch can only control one motor (or, if two motors are connected, both motors are controlled identically).

After doing some web searching, I found a site (Link) that references what I think must be an add-in to Scratch that includes new Scratch blocks allowing separate control for each motor. I have the source code in a file called “controlingTwoMotors.zip” described as a “Squeak CS/Image”. But have no idea how to integrate it into Scratch.

How can I integrate this code to gain access to the new blocks?

Thanks for any help!
Stephen
sxhat
New to Scratch
3 posts

Controlling two WeDo motors separately

Here is the link: https://sites.google.com/site/michaelvorburger/wedo
abee
Scratcher
1000+ posts

Controlling two WeDo motors separately

sxhat wrote:

Here is the link: https://sites.google.com/site/michaelvorburger/wedo
Hi sxhat,

1. Download http://squeakland.jp/abee/tmp/controlingTwoMotors.zip and extract it.
2. Put all files into your Scratch folder.
3. Drag and drop controlingTwoMotors.image to Scratch.exe (Windows) or Scratch.app (Mac OS X).

Enjoy!
Kazuhiro Abe
sxhat
New to Scratch
3 posts

Controlling two WeDo motors separately

Excellent! Thank you!

Stephen
Pete66
New to Scratch
2 posts

Controlling two WeDo motors separately

Abee, this is really great! Is there any reason why these extensions to Scratch1.4 for two motors wouldn't work on a Raspberry Pi? Best wishes,Peter
abee
Scratcher
1000+ posts

Controlling two WeDo motors separately

Hi, Peter,
The image for RasPi is a little bit different from others.
So I made an image for you, but not tested.
http://squeakland.jp/abee/tmp/NanoBoardAGWithMotorsRasPi.zip
Could you let me know it works or not?
Thanks.

Kazuhiro Abe
Pete66
New to Scratch
2 posts

Controlling two WeDo motors separately

Hi Abe,
Many thanks for doing this image specially, I really appreciate it. I will post how it works!

Peter
kejava
New to Scratch
6 posts

Controlling two WeDo motors separately

I just tried the image with Scatch 1.4 on Linux. I keep getting a blank white screen when I either call it directly with squeek or by renaming it as scratch.image. Does the image need to be recompiled to work with Linux?
abee
Scratcher
1000+ posts

Controlling two WeDo motors separately

Hi, kejava
Please check #6 and try it.
That image might be compatible with not only Raspbian but also other Linux.
kejava
New to Scratch
6 posts

Controlling two WeDo motors separately

Kazuhiro,

Well that is pretty darn impressive. It didn't even occur to me to try the RasPi image. It works great! Just tested it my two motors attached to a single hub. Also tested my tilt and distance sensors. One thing I noticed when opening the two motor example the came with the original zip were the “obsolete” blocks, see here. Just curious, any idea what is obsolete?

Also, how did you build this? Is the source code that .cs file and that huge .changes file? I was thinking about adding support for more sensors, maybe even some lights (when I get some).

I've been playing with Python and the WeDoMore module. That works great too on Linux. You ever hear of anyone consider a porting the Scratch 1.4 source to Python?

-KevinV
kejava
New to Scratch
6 posts

Controlling two WeDo motors separately

I'm not sure why the link to the screenshot didn't show Trying again …


abee
Scratcher
1000+ posts

Controlling two WeDo motors separately

kejava,
Thank you for testing. I'm glad to hear that my image works on other Linux platform.
The blocks for motor are different from controlingTwoMotors and NanoBoardAGWithMotors.
So please use the example projects in the following zip file for NanoBoardAGWithMotors.
http://squeakland.jp/abee/tmp/NanoBoardAGWithMotors.zip

You can make your own mod image by filein the cs file (not changes file).
1. Open scratch as root, then Shift-Click-R to enter Squeak Smalltalk environment.
http://wiki.scratch.mit.edu/wiki/Shift-Click-R
2. Open “filelist” from the background menu and choose the file, “NanoBoardAGWithMotors.1.cs”.
3. Choose “fileIn” from the right button menu to compile it.
4. Choose “save as…” from the background menu and give a new image name.
5. Shift-Click-R again and choose “save image for end-user”.

I'm a Smalltalker, so I love to make mods in Smalltalk, sorry.

Kazuhiro Abe
kejava
New to Scratch
6 posts

Controlling two WeDo motors separately

Hi Kazuhiro,

Wow, that is very cool! I never used an application that did something like that. Thanks for the link and the description. I definitely would not have figured it out by poking around. I can't wait to start breaking things …

As for language, I don't have much of a preference. Whether I'm pumping fluids across sensors for the medical device industry, scanning wavelengths for the telecom industry, or controlling hydraulics to test actuators for the aerospace industry, the right language for me is the one that talks nicely to my hardware without getting in the way. I've read a little about Smalltalk in the past. I'm hoping to learn more about it's strengths.

Thanks for your help!

-KevinV
jmandonegi
Scratcher
1 post

Controlling two WeDo motors separately

Hello:

I have a project with two motors that works fine in Windows but have not been able to make it work in Raspberry Pi.

I have tried to follow the instructions in this forum post but I still get obsolete blocks.

I'm newbie with raspberry, so I would appreciate a step-by-step instruction to know where should I copy the files of the image and the other files. In Windows, I have copied them to program files, but I don't know how to proceed in Raspberry pi.

Thanks!
kejava
New to Scratch
6 posts

Controlling two WeDo motors separately

Hi jmandonegi,

I might be able to help but I've never done any work with the Raspberry Pi. My guess is that it should be very similar to getting it running on any standard Linux distribution. The only tricky thing you might run into is getting permission for Scratch to access the USB port. From what I've read though, Raspbian supports Scratch 1.4 (arm) and USB connectivity to WeDo right out of the box.

Does your unmodified version of Scratch 1.4 run properly with the standard single motor control on the Raspberry Pi? If so, then getting two motor control should be as easy updating the single file that Kazuhiro Abe linked to in Message #6 of this thread. On my Xubuntu 14.04 install, the scratch image is located in /usr/share/scratch/Scratch.image. Simply backup the original image file (sudo mv Scratch.image Scratch_original.image) and copy over the new one for two motors from the downloaded zip file as “Scratch.image” to that same folder.

I know … not exactly step-by-step but I'm not sure what part you are stuck on. I'm also quite clueless about the Raspberry Pi setup. I found a nice discussion on this subject here for your reference:
http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=62957&p=558625

-KevinV
abee
Scratcher
1000+ posts

Controlling two WeDo motors separately

Hi, jmandonegi
I made an all in one package. Please download it from the following URL.
http://squeakland.jp/abee/tmp/NanoBoardAGRasPi.taz
Then extract it by the following command.

$ tar zxvf NanoBoardAGRasPi.taz -C ~

Two icons will appear on your deskcop.
NanoBoardAGWithMotorRaspi is for one motor. (compatible with Scratch 1.4 project)
NanoBoardAGWithMotorsRaspi is for two motors. (incompatible with Scratch 1.4 project)

Best,
Kazuhiro Abe

Last edited by abee (Aug. 31, 2014 07:41:17)

CarlosBGZ
New to Scratch
1 post

Controlling two WeDo motors separately

Hi Abee,
I need connect two motors ( one hub) and one distance sensor(another hub) with Scratch 2.0 (online and offline editor).
When try only works the two motors or the sensor, but not together.

In offline editor (scratch 2.0) use wedo_template, and have the same problem.

I try with python 2.7, WeDoMore, install pyUSB, but same problem only work motors or sensor. I think use the controlingTwoMotorsWithMesh with two computers, is this the solution?.

Thanks
abee
Scratcher
1000+ posts

Controlling two WeDo motors separately

Hi, CarlosBGZ
Unfortunately it is a limitation of WeDo plugin for 1.4 and external extension for 2.0.
If you need to use two motors and other sensors at the same time, please consider to use sensor board with them.
As you pointed controlingTwoMotorsWithMesh is one of the solutions. You can connect two Scratch with each WeDo hub via Mesh. It's possible to use upto 4 motors or 4 sensors together. I explained how to do it at the old Scratch forum, but it was lost…

Last edited by abee (Sept. 1, 2014 03:36:49)

cops911
Scratcher
100+ posts

Controlling two WeDo motors separately

Are you asking if two WeDos can have separate programs?

when green flag clicked
wait until <(Love and Fave)=[true]>
set [cops911 v] to [happy]
25bluemonkey
Scratcher
17 posts

Controlling two WeDo motors separately

Powered by DjangoBB