Improving Scratch -RaspberryPi GPIO Control Performance

The light at the end of the tunnel is getting a bit brighter 🙂

The reason my current scratch_gpio_handler.py doesn’t handle sequential variable changes is that Scratch codes them up differently (for efficiency) and that I need to use something like this https://github.com/pilliq/scratchpy/blob/master/scratch.py

to handle them.

Also, the CPU time used by Scratch seems to increase whenever you create more variables.  I’m assuming this is because it starts checking for changes in variables when RSC is enabled.  This increase in CPU load doesn’t seem to take place if using broadcasts so I’m going to change my python code to try and incorporate these two things and lets see if we can improve performance 🙂

Backup your Pi

Every now and then and especially once you’ve made a very useful change to your RPi (got your wifi USB adaptor working or made it autostart into LXDE etc) then I recommend creating a backup image of your whole SD card.

On windows, the easiest way is to connect your card to your PC and use Win32 Disk Imager in read mode.
e.g Insert SD card into your computer/Card Adaptor and run Win32 Disk Imager, click on browse icon and create a new file somewhere to save your image – then click Read and the program will do the rest. 🙂

Remote Sensor Connections

Still coming up to speed with Scratch on a RaspberryPi and its ability to communicate to other processes 🙂

Remote Sensor Connections (RSC) – can be enabled by right-clicking on the bottom sensor block in the Sensing section.

This seems to do the same as using Mesh with the advantage that if you save a project with RSC enabled – Scratch will re-enable it when you re-load the project 🙂

So no need to use a modified Scratch at the moment 🙂

Scratch on Raspberry_Pi

I’m a computer geek who looks after IT stuff in primary schools but also does a bit of IT teaching on the side and if it involves using Scratch, whether for simulation or animation, then I’m the man for the job.

Along comes the Raspberry_Pi, with Scratch on board and access to input/output and I go – yippee – low cost – easy to program D&T computer controller.

Last night, I mangaged (by stealing/borrowing/hacking a load of info/code from other people who are much cleverer than me) to get Scratch to blink an LED on my RaspberryPi.

I’ve put a short youtube vid to prove it but I’ll be using this blog to show/tell others what I did to get it working

http://www.youtube.com/watch?v=6zBXGL99hPU