This repository and project has now been archived and is no longer supported. The code will remain available for reference and information.
Scratch extension prototype
This is a prototype I created of how the Raspberry Pi Scratch extension could be implemented.
It was created as a way of supporting a conversation rather than a statement of intent.
Notes:
- The code is a bit "hacky", its not meant to be production!
- the
set input [pin] to [pull_up / pull_down]
doesn't work as it would have required significant re-development of the extension.
Installation
- Clone this repo.
cd /home/pi
git clone https://github.com/martinohanlon/scratch_ext_prototypes
- Backup your existing scratch 2 extension.
cp /usr/lib/scratch2/scratch_extensions/piGPIOExtension.js /home/pi/scratch_ext_prototypes
- Install the prototype
sudo cp /home/pi/scratch_ext_prototypes/piGPIOExtension.js.prototype.js /usr/lib/scratch2/scratch_extensions/piGPIOExtension.js
-
Start Scratch
-
Restore original extension
sudo cp /home/pi/scratch_ext_prototypes/piGPIOExtension.js /usr/lib/scratch2/scratch_extensions
Initial prototypes
These are some early prototypes I created to support debate.
The prototypes "work" although the code lacks finesse having been pulled together in a hurry!
Events
piGPIOExtension.js.events.js
This adds an Event (or hat) block of when gpio [number] goes [high/low]
to the existing extension.
Pin based
The pin based prototype uses a pin description rather than a gpio:
Device based
This prototypes splits blocks down in "devices" (LED, Button, Buzzer, PIR) to show how a higher level of abstraction could be implemented.