Sniff is a "Scratch-like" programming language that's designed to help Scratchers move gently from Scratch to more conventional languages. They can start writing programs, without having to learn a new language because Sniff is based on Scratch. They learn a little more about variables, compiling, syntax errors (!), and they can have fun controlling real hardware while they're doing it.

Friday, 1 May 2015

Raspberry Pi Desktop Shortcut for Sniff

Last year we put a lot of effort into getting the core of Sniff right. It's now a solid programming system, with a rich set of libraries, running on a wide range of platforms. We're not working with teachers to iron out the wrinkles and make it easy to use for non-techies.

Sniff is essentially command line based, with a  compile command which generates an executable. You can use it with any IDE, or simply a text editor. To make things easier for new users we wrote SniffPad - a simple IDE for Sniff, written in Sniff. However as that's a Sniff program you generally need to run it from the command line.

To make it even easer, on a Raspberry Pi or other Linux system you can make a desktop shortcut to Sniffpad, so users can just click the icon, and just straight into writing Sniff code.

The first thing to setup is the shortcut itself. Create a file called Sniff.desktop in your Desktop folder, containing the following text:

[Desktop Entry]
Comment=Setup Sniff, and run Sniffpad

You'll need to edit the Icon and Exec lines to point wherever you've installed Sniff. In this case I've unpacked the Sniff distribution into /home/ian/Sniff. In future releases that's all you'll need to do, but if you want to try this out right now, then you need to go to the Snif/utils directory and make a folder called PiShortcut. Inside there put an image file sniff.bmp. 

Finally we need a script which is actually going to run. We can't link directly to SniffPad, as we first need to set up the Sniff environment. Place the following text in a file called runSniffpad inside the PiShortcut folder, and make sure its executable (chmod 755 runSniffpad).

DIR=`dirname $0`

cd $DIR/../..
. ./setup

mkdir -p $HOME/SniffProjects
cd $HOME/SniffProjects

This finds the Sniff folder based on where the runSniffPad command is, and runs setup. It then cd's to a folder called SniffProjects, where you can save your work.

Now just double click and you're good to go!

No comments:

Post a Comment