Scratch is great visual environment very easy to understand by children.
I already blogged that Scratch is running fine on OLinuXino here https://olimex.wordpress.com/2013/03/12/a13-olinuxino-wifi-running-scratch-ide-perfect-platform-for-kids-programming-education/
What bothered us though was that we can’t use all GPIOs and hardware resource which OLinuXino offers and Scratch basic installation can only play music and make cool animations.
So we start searching info how to implement this.
Soon we found SNAP http://snap.berkeley.edu/ which is based BYOB (Build your own Blocks) which is based on Scratch but adds ability to make your own blocks, recursion etc new features.
I asked Technoboy10 is there documentation how to connect Hardware to SNAP and soon he published this info in the Wiki: https://github.com/Technoboy10/snap-server/wiki/How-to-create-a-Snap!-Extension which is very detailed.
So How cool is this? Kids are able to program robots with visual IDE!
Looking at Technoboy10 GitHub repository we figured out how to do this, but SNAP basic installation have no such great choice of sprites and animation examples, so I decided for the beginning to try to implement OLinuXino hardware features to SCratch.
So I posted question on Scratch forum and start to wait for reply http://scratch.mit.edu/forums/viewtopic.php?id=115821 . After few days waiting, 30+ views and none reply I did what I had to do at the beginning: searched github for “scratch c” then for “scratch python” and found what we needed:
This is cool python client for Scratch. When you enable remote sensors in Scratch it creates server, then with scratchpy you can pool for given variables and take their values or change them, this way you can connect sensors or actuators.
As opposite to SNAP (where SNAP i client and snap-server is made with pyton, so SNAP connects to the server) here Scratch makes server and the scratchpy client connects to it and interact through variables.
So here is our first “Hello World” blinking LED with Scratch: http://www.youtube.com/watch?v=qbTNWTa5tXQ
Instruction how to install the OLinuXino GPIO interface to Scratch is on GitHub: https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/A13/A13-GPIO%2BSCRATCH
Our second project animate GPIO connector with Scratch based on real buttons inputs and LED outputs:
Here is video on the GPIO interaction with SCRATCH http://www.youtube.com/watch?v=DzmvqlQodac
Now when we have this powerful tool: scratchpy to interface Scratch to anything via python, just imagine what would happend if we connect Scratch to … OpenCV 🙂
From my previous blog I show you some videos which demonstrate the power of OpenCV: face recognition, face expression recognition, color objects tracking. You can make SCRATCH script for instance which recognize the face of the person in the fron of the web cam and run some animation to welcome it by name.
Or you can program your robot to chase this yellow pong ball which is in the front of it.
Or you can make different animations depend on the face expression of the person in the front of the camera… the applications and the fun will be endless!