Scratch GPIO Extension For The Raspberry Pi

The WIC GPIO extension for Scratch 2 opens up the GPIO to allow for the driving of addressable LED strips using the WS2812 LEDs. It provides a range of commands used to control the outputs.

[eyes direction block]

This controls the eyes allowing you to select a direction for the eyes to look in, and a time before they move back into the center. The block will halt execution of the code until the timer has timed out, so use it in a separate flow to any code you require to happen during the this time.

[led colour and addressing block]

This block allows you to select an individual LED to light in the selected colour, or to light all of the LEDs in the selected colour. To create a chase effect on the LED strip you can add the block multiple times, selecting a different LED on each one. To control the speed of the chase add a wait block between each of the LED blocks specifying the same time on each block.

[led patterns block]

The LED patterns block allows you to select one of the following preset patterns to be displayed on the LED strips:

  1. Chasing single pixel
  2. Chasing pixel group
  3. Inverted chasing single pixel
  4. Inverted chasing pixel group
  5. Fade through rainbow of colours
  6. Red / Green / Blue alternating colours
  7. ???
  8. ???
  9. ???
  10. ???

[jaw position block]

This block allows you to control the jaw of the skeleton and has settings for open and closed. When used in conjunction with a sound being played it is possible to make the skeleton appear to be talking.

 

 

Posted in .

With over twenty years of experience in the computing industry, John has gained a reputation for his knowledge and experience. Over the years he has worked on developing card payment systems and e-commerce solutions, to blogging and social media. John provides consultancy and training services to individuals and SMEs as well as helping to teach the next generation of computer scientists through his work as a Code Club volunteer.

Leave a Reply