Introducing Scratch GPIO Universal Translator

Posted: March 28, 2013 in Guides, RGB-LED Kit

As mentioned at the end of the last Scratch lesson, using the bit patterns to control the RGB-LED kit can get a little confusing, and it really does not fit in with how user friendly Scratch is intended to be. So, we need to help our friend Scratch talk to the RGB-LED kit in a way that is slightly more natural.

Scratch still can't make him self understood by his new friend, we need to help him!

Scratch still can’t make him self understood by his new friend, we need to help him!

So how do we translate what Scratch is saying into a format that the scratch_gpio_handler can understand?

Well for these basic commands, we can allow the handler to look up any commands which include “rgb” using a handy RGB-LED universal translator, which we will call “rgb_ut.py”.  At this stage, the universal translator will be given any message which the handler does not understand which has something to do with “rgb” and just return a translation of the message which he does understand. i.e. “rgballon” becomes “pinpattern1110000”

The Scratch GPIO handler can now look up anything he doesn't understand using the "ut" files.  They can understand each other again!

The Scratch GPIO handler can now look up anything he doesn’t understand using the “ut” files. They can understand each other again!

I am still developing the abilities of the “ut” at the moment, but there will be another Lesson coming soon which will explain how to install the RGB-LED Universal Translator (and update it as it changes) and some examples using it.

NOTE: I’ll also explain how it all works in more detail in the extra credit section of the lesson.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s