Archives

Blogroll

Archives for May 2014

I bought a Lego WeDo set for my son, this set is composed by some lego technic pieces and a Hub with USB where you can connect a motor and two sensors, distance and tilt. This set works natively with Windows and OSX but not with Linux. The software includes gives you an educational graphical tool for programming based on scratch.

Scratch is a graphical programming tool for education designed by MIT, you can find more info on scratch website.
The software included with Lego is a more simplistic and easy for kids kind of scratch, It has less options, bigger buttons, and sounds that match the lego instruction designs, this software is not free, It cost 85€ and is sold separately from the inital box (WTF!). However It is possible to use original MIT scratch with Lego WeDo and Linux.
There are two versions of scratch, the 2.0 is web based and It doesn’t work with Lego and Linux, but the older on 1.4 works with Lego Wedo and It is included on Debian Wheezy.

But It doesn’t work, you need to add a udev rule, to do that create this file
/etc/udev/rules.d/99-wedo.rules with this contentATTRS{idVendor}=="0694", ATTRS{idProduct}=="0003", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev"

Then restart udev with/etc/init.d/udev restart

Now everything is ready, start the scratch from Applications->Education-> Scratch.

Unhide the Lego Wedo options from the Edit Menu.

You will find new motion options

And on the sensors you have the Lego Wedo sensors tilt and distance.

In order to wait until a sensors detect a condition you can use this structure, a wait condition, an operator and a sensor box like this.