Whiskers – Scratch2 coded in Squeak- works on Pi

Just found https://scratch.mit.edu/discuss/topic/157672/?page=2#post-1574788 which is a Scratch 1.4 mod built to emulate Scratch 2 features 🙂

And since it is written in Squeak – the image works on the RaspberryPi as well 🙂

To use on the Pi download this from the new website, unzip it and save it into /home/pi folder

(need to use sudo for these commands)

sudo cp /home/pi/Whiskers.image /usr/share/scratch
sudo cp /usr/bin/scratch /usr/bin/whiskers

Then

sudo nano /usr/bin/whiskers

and change line 9 to be

IMAGE=`ls -t /usr/share/scratch/Whiskers*.image| head -1`

and save it (CTRL-X followed by Y then enter)

Then to run Whiskers type

sudo bash /usr/bin/whiskers

or create this file using the text editor in /home/pi/Desktop and call it whiskers.desktop

nano /home/pi/Desktop/whiskers.desktop
[Desktop Entry]
 Encoding=UTF-8
 Version=1.0
 Type=Application
 Exec=whiskers
 Icon=scratch
 Terminal=false
 Name=Whiskers
 Comment= Programming system and content development tool
 Categories=Application;Education;Development;
 MimeType=application/x-scratch-project

 

If you want to run ScratchGPIO with Whiskers then follow these isntructions supplied by  Steve aka “@NoSheds” on twitter

You must already have Scratch GPIO7 installed.  If you haven’t, then follow these instructions

Create a Whiskers GPIO desktop icon:

 nano /home/pi/Desktop/whiskersgpio7.desktop

paste in

[Desktop Entry]
 Encoding=UTF-8
 Version=1.0
 Type=Application
 Exec=/opt/scratchgpio7/whiskersgpio7.sh
 Icon=scratch
 Terminal=false
 Name=WhiskersGPIO 7
 Comment= Programming system and content development tool
 Categories=Application;Education;Development;
 MimeType=application/x-scratch-project

Create a shell script to run ScratchGPIO with Whiskers.  Simplest way to get the file permissions etc is just to copy the existing scratchgpio7.sh file

sudo cp /opt/scratchgpio7/scratchgpio7.sh /opt/scratchgpio7/whiskersgpio7.sh

then edit it with

sudo nano /opt/scratchgpio7/whiskersgpio7.sh

and change the last line from scratch to whiskers:

whiskers --document "/home/pi/Documents/Scratch Projects/rsc.sb" &

 

Simon

Contact me if this doesn’t work

 

You may also like...

24 Responses

  1. David Ferguson says:

    Does this have access to the experimental HTTP extensions, or Python extensions, or none of them?

  2. cymplecy says:

    Its a Scratch 1.4 mod so it works with the 1.4 broadcast mechanism (as used by all my Scratch handlers) – tried it out with my ScratchGPIO handler and it works fine with that 🙂

  3. Maria says:

    I am using a Raspberry Pi 3 and have followed the above instructions. I get a blank black screen. I suspect it is something to do with the latest version of software or maybe I have something adrift.

  4. Jarrod says:

    I’ll try the instructions on on a new image

    Pretty certain the camera stuff won’t work though 🙁

    Broadcast photo is mainly handled by sgh_RasPiCamera.py (all code is in /opt/scratchgpio7 folder – root access needed to edit so use sudo if playing

    Most of the code is their to deal with scratchgpio running as root user and making sure photos go into a pi user folder – the taking of a picture is trivial 🙂

    What is that your after as it might be quicker to just get me to do it?

    • cymplecy says:

      Seem to have lost your comment – sorry!

      it didn’t work for me – files have been changed since then – I’ve found new one and updated instructions – should work again now 🙂

      Simon

  5. Jarrod says:

    Hi Simon,
    Many thanks for your reply. Very helpful info and working now (although haven’t checked with ScratchGPIO yet) I’d actually thought broadcast photo was something contributed by Matthew but realised today that it was built in to scratch and your version just added file storage (I think that’s correct anyway).

    Tried reloading everything before you replied to see if that would fix the problem and noticed that file storage no longer seems to work. The photo folder gets created but no images are stored….

    Thanks again. At the moment just playing and learning so I don’t need any changes. (Actually I didn’t want the file stored so the built in suits me fine) Though that prompts a question… If I use ScratchGPIO for GPIO functions, how do I make sure the broadcast photo goes to the standard handler and not yours?

  6. cymplecy says:

    This is getting confusing – I presume we are not talking about Whiskers anymore?

    The photo functionality in ScratchGPIO was provided by Matt Venn. I’ve no idea what NuScratch does (I don’t have ANYTHING to do with that for political reasons)

    Is there an un-answered question left 🙂

  7. Jarrod says:

    Hey Simon,
    Yes, just scratch, I haven’t got round to looking at whiskers yet although your installation instructions did work thanks.
    Yes, the photo functionality provided by Matt. (That doesn’t seem to store photos anymore, just create the photo directory)
    My question was, if I wanted to use the standard photo functionality in Scratch (not Matt’s) but use ScratchGPIO for GPIO functions, is that possible?
    Regards, Jarrod
    I never mentioned NuScratch! Sorry for the confusion!

  8. cymplecy says:

    1. Ok
    2. So your saying it doesn’t store photos – I’ll check that out
    3. “Standard photo” So Scratch 1.4 doesn’t take photos – ScratchGPIO (which is Scratch 1.4 with python handler) should take photso using Matts code – so where is what you call “standard photo functionality”?? This is REALLY confusing
    4. NuScratch is name given to the modified Scratch 1.4 that is installed on a RaspberryPi

    Confused? You will be – I blame them – they blame me 🙂

  9. Jarrod says:

    Hi Matt,
    And there was me thinking this was going to be easy!
    3. Just so I didn’t give you bad info….I Just did a fresh install from Raspian image directly. Ran Scratch 1.4 with a broadcast photo (after starting GPIO server from Edit tab) and it pulls a picture from my usb webcam and stores it as a new costume.
    This is where I thought I was unconfused, as I thought Matt’s broadcast photo just added the storage of the costume picture to disk.
    5. On a seperate issue I was expecting to see Scratch 2 functionality in Whiskers. I couldn’t find the video sensing block which I thought was a standard Scratch 2 function.
    Cheers, Jarrod

  10. Jarrod says:

    After reading further I think I understand 3! I had thought GPIO server was standard scratch but I guess it’s not and ScratchGPIO7 is a variant of the server?

  11. Jarrod says:

    I was confused as I thought I was running standard scratch on the pi as this is the title under ‘Programming’ and also the name of the window it runs in and in the ‘Help About’ while running NuScratch. Getting to grips with this I think!

  12. cymplecy says:

    History 🙂
    Scratch couldn’t talk to hardware but it can send and recieve broadcast messages over LAN – and send variable updates as sensor-messages

    So when Pi came out, PiFace peope wrote python prog to listen for broadcasts and send input dat back as sensor updates.

    I took this code and made it work with plain pins without any addons – and “disguised” it so users only had to click on desktop icon to run normal Scratch 1.4 and my inivisible python background program that did the heavy lifting.

    Only person that directly added code to my project was Matt who added the photo capturing bit

    Due to reasons not worth going into, Raspberruy Pi commissioned someone different (than the 3 people who;d already done it) to have their own way of talking to GPIO – the modified version is generally reffered to as NuScratch to differentiate it from the standard Scratch 1.4 that runs on pi/Linux/Mac and Windows.

    Web based Scratch (or Scratch 2 or just Scratch) is near end of life and about to be replaced with something based on Google blockly (so HTML5/javascript_ No-one knows whether it will support hardware extensions but past experience leads us to believe that it will not be a priority for them (apart from Lego WeDO support as they pay them money for it)

    Simon

  13. Jarrod says:

    Sounds like there has been an ‘interesting’ history along the way. I’ve been looking at scratch/pi/gpio etc. as scratch is taught at my children’s school and it seems a good fit with the pi and open to talk with hardware . Seems a shame that Scratch is coming to an end, especially if that means the alternative may be less flexible and maybe not as alligned from an educational perspective. I would hope Scratch will have legs for a good while yet though, especially considering the resources that have gone into it.
    Thanks again for your help, it’s all becoming mostly clear! Jarrod

  14. cymplecy says:

    Scratch isn’t coming to an end – its being actively developed into V3

  15. Thanks for this. It’s an awesome mod, but there are a couple of bugs that will make it very hard for kids to use – hope you can help 🙂

    When you click on costume the options for new costume from library, edit costume and upload file all generate error messages: MessageNotUnderstood:ScratchScriptEditorMorph for importimage, drawnewcostume and choosefromlibrary. Any ideas??

  16. Hi,

    I have installed Whiskers according to procedure described here, to get benefits from creating custom blocks. When I try to load project created in Scratch and ScratchGPIO 8, Whiskers crashes without error dialog. I am using Raspberry Pi 3 with Raspbian.

    Could you help me to check and solve it?
    Where can I find any log file? What should I provide you to have more information?

    Regards

Leave a Reply to cymplecy Cancel reply

Your email address will not be published. Required fields are marked *