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.
Showing posts with label Release. Show all posts
Showing posts with label Release. Show all posts

Tuesday, 21 February 2017

Release 30 - at last!

It's been a while since the last release, and while there's not to much in the way of major changes there are a lot of tweaks on fixes. Most importantly the documentation is much improved - check out the "doc" folder for both an improved/updated manually and separate documentation for a lot of the different devices (as both Pages, and PDF's). This is still a work in progress, but it should make things a lot easier for everyone.

We've also made some tweaks to SniffPad that you'll appreciate if you're running on a laptop - its now a LOT less CPU intensive, which means it won't hog your battery, and it a little more responsive on slower machines.

When reworking the documentation we also made a few tweaks to the compiler - a few odds and ends had been missed, which should now work. We also changed the error message so instead of things like "syntax error" it now says things like "oops" and "I don't understand". Hopefully its a bit less intimidating (and clearer for people who don't actually know what a syntax error is yet!).

There's also the usual updates of devices and examples. We added support for cheer lights - just cause they're fun. There's a cheerlight demo for flotilla, plus code to bridge cheer light to MQTT.

Check it out on the downloads page.



Wednesday, 12 October 2016

Release 29 : Back to school!

Teaching has started again, which has pushed this release back a bit. Finally I've got a quiet few days to push out the latest fixes and features!

The first thing you'll notice if you use SniffPad is that syntax highlighting has improved a bit... variable names are now blue, which is handy as it means there's a visual indicator that you've spelt a variable name wrong when you type it, rather than getting a weird error message some time later. You might have noticed this already if you've tried live.sniff.org.uk.

The headline feature is of course MQTT support. There'll be more posts on that over the next few days, but if you want to place Arduino's to measure and control things using a network, then you should be very excited. Combining Sniff and MQTT makes building network sensor about 8 lines of code, and it will integrate with whatever control system you want to run on your central servers.

There's also the usual round of bug fixes and tweaks that are really important, but too small to mention.

Head over to the downloads page to grab a copy.

Friday, 16 September 2016

Sniff Live For Arduino

Our initial implementations of Sniff Live were aimed at getting regular programs compiling and running in the browser, so it would be easier for new users to write a few simple Sniff programs without having to install the system. On Windows in particular installation is a bit of work (it's MUCH easier if you're running Linux or Mac).

However the most fun projects we do with Sniff involve external hardware - usually the Arduino Uno, so getting that working with Sniff Live was something we always had as part of the plan, and now its ready for you to try out.

If you head over to live.sniff.org.uk  you'll see that on the front page there's a suggestion to download the Loader app.  Download and unzip it somewhere. The Loader app is the easiest way to upload intel hex files to an Uno, though if you have any other method you prefer that will work too.

Then log in as usual, and take a copy of the blink example using the "copy examples" pop up in the top left. Once you've got that, press the Arduino button in the editor to compile your code for arduino. If you were running Sniff on your own computer, this would also do the flashing for  you, but unfortunately it can't because now the code is being compiled on our server, while the arduino is connected to your PC!

Once the code is compiled, press the "run" button, either in the editor, or in the sidebar (the run link might not appear straight away). This should download the hex file to your computer. The exact details of what this looks like will depend on your browser and its settings, but you should save the file, and open it.

Your PC probably doesn't know what to do with a "hex" file, so set up the file association so that it opens in the "UnoLoader.exe" that you downloaded earlier. From then on when you double click a hex file, or tell your browser to "Open" it, then it should upload the code straight to your arduino without any further intervention from you.

If UnoLoader doesn't work, then check that you have an Uno connected, and that it is appearing as a COM port. If UnoLoader does fail, then its window will stay open and it will tell you whats going wrong. Check out what it says the problem is, and if you can't figure it out, let us know.


Monday, 12 September 2016

Sniff Live!

We've been fairly quiet recently, as we've been working on a big project. It's not exactly a secret (as we've mentioned it in a previous post), but we're just about ready to make a bit more of an announcement about it...

You can now program Sniff entirely in a browser!

After a few year of trying to make the install as easy and as portable as possible, we now have a solution which requires nothing installed on your machine. Just go to http://live.sniff.org.uk, and enter your name to create an account. From there you'll be taken to the online IDE, which is basically the regular Sniffpad IDE but now everything is online.

This isn't intended as a replacement of the regular Sniff implementation - more as a way for you to get started, so it's slightly more limited, but hopefully being able to try stuff out and online will make it an easy way to get started.

To run a program, just press the compile button, and then the run button. Run requires you to enable pop-ups as it runs the program in a new window. Alternatively if a program has been compiled previously a run link will appear in the left sidebar, which doesn't require pop-up permissions.

On the left sidebar you can copy some demo's which are preloaded onto the system, or edit programs you've previously worked on. You can also upload/download code or images. Images can be edited using the paint package, though it is limited to quite small images. Any code you write can load and save files to your account on the server - either text files or image files.

The system can technically compile code for Arduino Uno too, but currently it there's no way to actually execute that code on a board. We're working on that but its a bit tricky!!! 

The system is still in its development phase, so expect things to change/break, but hopefully it should make it a lot easier to use Sniff on a wider range of computers.

Check it out at: http://live.sniff.org.uk

Thursday, 21 July 2016

Release 28: And About Time too...

We normally seem to push out a release every month or so, with some new drivers and a few fixes and optimisations. However since the massive Microbit push back in April we've got almost 3 months without an update. I'm blaming end of school year burn out!

So here we have release 28. To be honest, its been such a long release cycle some of the thing that have gone into it seem like ancient history. There are lots of updates, and fixes for Microbit that just missed the last release, including code for the demos. It should also be a little faster.

jsniff has seen a lot of work. This lets you compile sniff programs to javascript and embed them in a web page. We've been using this internally for a fairly major application that we'll announce soon. If you compile with "jsniff -S xxx.sniff" it will include code to load and save files to a web server for permanent storage, so you can make really advanced web apps. There's a bit of work you need to do server side, but we'll document that soon. If you get a compiler error about "blacklist"ing when compiling with jsniff then you need to make a minor mod to your emscripten install - check the error line which should specific a line of code in the emscripten code... just edit that file, and delete the two lines and you're good to go again. More details later...

If you use the Arduino ethernet shield we've made a change to the way the ip address is specified. Previously this was stored in eeprom, but to increase portability you need to add this to your code. Check the examples/Embedded/webclient example to see how.

Finally we added support for Philips Hue light bulbs!! This is lots of fun, as you can make your own devices to turn your lights on and off. This is still a pretty basic implementation, and we'll probably add more to it in the future

There's a few other odds and ends in there too, but head over to the downloads page and try it out!

Incidentally "and about time too" is the title of Bernie Marsden's first solo album from 1979.

Thursday, 28 April 2016

Release 27: Micro:bit!

Last week we took the unusual step of putting out Release 27pre, as we were keen to get Microbit support out as quickly as possible. We've now spend quite a bit of time with it, and have made a few minor fixes and changes. It's now pretty stable, and we've been able to test it with quite a bit of external hardware, including the Nokia 5110 screen, an SD Card reader, and a dht22.

Before you can use Sniff with Microbit you'll need to install Yotta from mbed.org. This is really easy on Mac and Windows. For Linux it may be more of an adventure! Let us know how you get on.

We've also produced a series of Tutorials for the Microbit, taking you from never used Sniff, through to using all the features of the Micro:bit.

We're really excited about the new platform, so have fun with it, and get in touch to let us know how you're getting on.

Release 27 is now now on the Downloads page.

ian@dctsystems.co.uk


Monday, 18 April 2016

We has Micro:bit!

It's been a rough ride with the BBC Micro:bit... We were really excited by the initial announcement, as its a perfect platform for Sniff, and Yr 7's are exactly the age group we think should be ready to move from blocks to text. Then came the waiting. We did some work on MBED to get things rolling, then then the MBED platform developed its own issues.

Finally we got our hands on a Microbit, last week and all is forgiven.  With a final blitz we've been able to get Sniff running on the Microbit. Because we're so excited about this we've pushed out a 27PRE special release. If you don't have a Microbit then stay away from it, as it may have introduced bugs on other platforms like Arduino, but it runs pretty well on Mac and Windows. If you're using Linux then it should also work, but you'll need to figure out the file paths for your system.

To run it, first set up a working Sniff install for your local machine (on Mac just unzip the Sniff download, Windows users follow the instructions in the recent post and demo video.

Then install yotta from mbed.org. This provides all the microbit tools.

Then plug in your microbic, and you should be able to start running Sniff programs on microbit either by hitting the microbit button in sniffpad, or compiling code with mb-sniff.

There are loads of demo and test examples in the examples/microbit folder, but (if your new to Sniff) you should probably start with blink:

make led digital output D2

when start
.forever
..set led to on
..wait 1 secs
..set led to off
..wait 1 secs

We'll have a full Release 27 in the next week or so, once we've check that we didn't break anything else by adding in the microbit code. I'll also post a few tutorials over the next few days.

Sunday, 3 April 2016

Release 26: TLC for Windows

Release 26 is aimed squarely at Windows users.

Since we last did a windows focus release, a lot of things have changed in terms of the packages we rely on - MinGW, Arduino and Window's itself, so this time aroundwe've dedicated some time to getting everything to work as smoothly as possible for Windows users. We'll have a more detailed blog post soon, re-ittereating the Windows install requirements, but basically install MinGW/Msys, then just unzip the Sniff folder!

Now everything should run a bit smoother on windows, and we've even added a file called "ClickMe.bat"... which fires up sniffpad, and you can just start coding!

Unfortunatly the Arduino backend for Windows is crashing (its actually a bug in gcc!), so if you get a message that ld.exe is hanging when compiling for Arduino, try installing the old 1.0.6 version of Arduino.

If you're running Windows, then get over to the downloads page immediately. There's also few other minor fixes and features for everyone else too...

Monday, 7 March 2016

Release 25: Soul-Silver release!

Release 25 if Sniff is now with us, and brings the usuall cornucopia of goodies.

Features:

  • SniffPad improvements
  • Flotilla Support Improvements
  • Lego Control Lab B support
  • Improved Wedo Support
  • Embedded GPS support


A big call out, and thanks to Robin Newman for his help it getting the Flotilla support close to complete. The new release is more stable, and supports the changes made to the Flotilla in in its "shipshape" update/pre-release - make sure your FW is updated to this. We've were unable to test the full Flotilla system "in-house" as we only had access to a small number of the modules. Robin's done a great job testing the code (often long before we got close to making it work),  bug fixing, and demoing the system. The Motion module is the one outstanding thing to build and we'll have that going in the next few weeks.

We also 'discovered' the Lego/Dacta 9751 Control Lab B... and just had to get hold of one, and add Sniff support. These are about 20 years old and are one of the first Lego/Computer systems. Look at what they had available then, and what they have now, someone is clearly going in the wrong direction - 8 inputs & 8 outputs, easily controlled from a computer without any complex drivers or installs needed - that's like 8 Wedos in one box! There are more (and better) sensors available than the Wedo, and you can pick them up super cheap second hand. I hate to think how many of these have been thrown away when someone couldn't get the SW to work, or because they're just "old". Grab em while you can!

As we were building the SW for the Control Lab, we looked at what we'd learnt developing for Flotilla, and built a more "object oriented" interface to it, than we had for the Wedo. So then we went back and re-worked the Wedo to support the new way of talking to this hardware. You can code for Control Lab or Wedo using either the old Connector based numbering system or using the new method.

We've updated SniffPad so that it now does basic keyword highlighting, and formats text a little nicer, so you can see what's going on in your code so much better. 

On other minor thing you might need to know... To make the Pi versions easier to work with we've moved the GPIO support from the "sniff" command. Compiling on Pi with the command "sniff" just generates a regular executable. This means you don't need to run it as root. To access the gpio you can compile with the pi-sniff command. 

Tuesday, 12 January 2016

Release 24: Flotilla, Esplora and Gameboy!

We try and keep Sniff releases lightweight and frequent, pushing out small updates once every month or so, but Release 24 got a little bogged down in its own awesomeness. It started out with some improvements to SniffPad to make the formatting a little clearer, but then we started work on something really exciting...

We ported Sniff so that it runs on GameBoy Advance! Not only did we port the basic code, and add graphics drivers but we ported the complete sprite library to run directly using the GBA's hardware sprites, so you can take games you've written using the "Hosted" version of the Sprite device, and they run with only minor modifications on a real commercial games console! If you've got a "Flash Cart" you can your run game on the real device, or you can just test in an emulator. We'll have a post in the next few days to document how to set everything up and get going.

The Gameboy work was going well, when the Flotilla arrived in the post... Super excited, we immediately got down to reverse engineering it, and got it running in Sniff. We've already done a few posts, and released a preview version of the Flotilla code, but its now integrated into this release. We've also added support for "Slider" and "Dial" - these are untested, as we don't have them yet, but they're simple enough that they should work.

As if that wasn't enough, we got our hands on an Arduino Esplora. This is technically the same as a Leonardo, so there wasn't any low level work to be done, but we've added an "Esplora" device which lets you read all of the sensors on the board in Sniff. Again we'll post details of this over the next week, but the code and examples are all included.

There are also a few more subtle tweaks and features we've added: We noticed in quite a few of the examples we were declaring variables which were essentially constants, but that we had to make them as numbers, then assign to them. Instead now you can assign a constant value to a number when you create it:

make gravity number 9.81
make maxWidth number 640

If you do this the value can never be changed. While this is slightly different to the way it works (for example) in C, but we think it makes more sense.

The other neat language feature is that you can now access command line args, so for example Sniffpad can take the name of a file to load:

make argv list of strings

when start
.if length of argv = 1
..set filename to item 1 of argv
.else
..set filename to "new"


As if that wasn't enough, as we were working on the GBA port, we refactored, and simplified the way the runtime handles ports, which should make the system more robust, and more portable in the future. You shouldn't notice this, though in the short term it might mean some of the more obscure ports are misbehaving. Let us know if you find any issues.

Wit that all behind us we can finally announce SNIFF RELEASE 24!

You can grab Release 24 from the Downloads page.

Friday, 18 December 2015

Sniff and Flotilla

I recently posted that my Flotilla Medium starter kit had arrived, and I documented the low level code that you might find useful if you were going to write your own code to talk directly to the hardware. You could actually to that yourself entirely in Sniff using the serialPort device, but the plan was always to add Sniff devices to support the Flotilla.

I've now got those working, and you can download them and add them to an existing Sniff installation. Normally I'd release this as part of a full Sniff release, but it's getting close to Xmas, and I probably won't get a full release out until the new year. There's a particular cool feature that needs a little more work, so I'm holding off until that's fully working. In the mean time here are the files you need to try it out. The drivers (in the XHosted folder) need to be added to the lib/XHosted folder you already have. There are also some examples which I'll talk about now... [Update: as of R24 Flotilla support is included i the current release]

To compile the examples, use the normal "sniff" commands. On Unix platforms the Flotilla gets found the same way as an Arduino when you run "./setup". On Windows you'll need to explicitly tell it by typing:

export ARDUINODEV=COM4

or whatever port you have it on in the shell after you've run setup.



make flotilla device

make light flotillaLight device
make brightness number

when start
.forever
..tell light to "update"
..say join "Brightness:"[brightness]
..wait 1 secs


The first thing you need to do is make a flotilla device. This represents a the flotilla dock and much like the dock you don't actually need to do much with it. It just acts as a hub for all the other devices you might want to use.

Once you've got a dock you can make an actual module and do something with it. Here I've attached a light module, by making a flotillaLight device and calling it light. The Flotilla has 8 ports, but you can plug the module into any of them - Sniff will look for a light sensor and use whichever port it finds it on. However if there isn't one plugged in then it will give and stop your program.

Alternatively you can specify which port the module is plugged in to:
make light flotillaLight device 4

This has the advantage that if you've not plugged it in yet you'll get a warning message but your program will keep running, and you can plug the device into port 4 later. In future you'll also need to use this if you want to plug in multiple devices of the same type (the mega-treasure chest includes two light modules and two motors). At the moment you can only attach one of each type of module, but that'll be fixed before the full release.

To read or write a sensor, just tell it to "update". You can also tell the dock to update, which you might want to do if you're not updating any other sensors for a long time just to give it a chance to do any housekeeping work, but this generally shouldn't be necessary.

In the case of the Light sensor "update" sets the variable brightness and we just print it out.


make flotilla device
make thermometer flotillaWeather device
make temperature number
make pressure number


when start
.forever
..tell thermometer to "update"
..say join "temp :"[temperature]
..say join "pressure:"[pressure]
..say ""
..wait 1 secs


Weather works in the same way, setting temperature and pressure.

make flotilla device
make keypad flotillaTouch device 
make key1 boolean
make key2 boolean
make key3 boolean
make key4 boolean


when start
.forever
..tell keypad to "update"
..if key1
...say "1" 
..if key2
...say "2" 
..if key3
...say "3" 
..if key4
...say "4" 
..wait 0.1 secs

Touch sets the four variables to be true of false depending on if the button is pressed.


Rainbow is the most complex module in the Medium kit, and works just like the neoPixel device, except that we change the names.

make flotilla device
make rainbow flotillaRainbow device
make rainbowShade list of numbers
make rainbowColor list of numbers


rainbowShade is the brightness (between 0 and 100), while rainbowColor is the hue between 0 and 360. 

Rainbow Thermometer

Lets look at how we can use that to make "thermometer":

make flotilla device
make sensor flotillaWeather device 
make temperature number
make pressure number

make rainbow flotillaRainbow device
make rainbowShade list of number
make rainbowColor list of number


make counter number


when start
.repeat 5
..add 0 to rainbowColor
.
.forever
..tell sensor to "update"
..#say [temperature]
..
..delete all of rainbowShade
..set counter to 1
..repeat 5
...if counter*2+20<temperature
....add 10 to rainbowShade
...else
....add 0 to rainbowShade
...change counter by 1
..
..tell rainbow to "update"

We make a rainbow and a weather device, then fill the rainbowColor list with 0's representing red. Then we read the temperature, and fill in rainbowShade. Using counter, we calculate a value for each LED from 22 to 30 degrees. If the actually temperature is greater than that we turn the LED on (red). If its less than that we turn it off.

The result is a thermometer that displays temperatures from 20-30 degrees in 2 degree steps. This is a handy range as its easy to see the display change just by holding the sensor.

Altimeter

One of the neat things you can do with the weather sensor is measure altitude. We did this last summer using an Arduino and BMP180, but now we can do it with Flotilla. The code required virtually no changes - just swapping out the BMP180 for a flotillaWeather module:

make flotilla device
make sensor flotillaWeather device
make pressure number
make temperature number

make altitude number
make seaLevelPressure number
make seaLevelTemperature number

make message string

when start
.tell sensor to "update"
.set seaLevelPressure to pressure
.set seaLevelTemperature to temperature+273.15
.
.forever
..tell sensor to "update"
..broadcast calculateAltitude and wait
..set message to join "Temperature:" [ temperature ]
..say message
..set message to join "Pressure:" [ pressure*0.01 ]
..say message
..set message to join "Delta:" [ (pressure-seaLevelPressure)*0.01 ]
..say message
..set message to join "Altitude:" [ altitude ]
..say message
..say ""
..wait 1 secs



when calculateAltitude
.set altitude to seaLevelPressure/pressure
.set altitude to ln of altitude
.set altitude to altitude * 0.1903
.set altitude to e^ of altitude
.set altitude to seaLevelTemperature * (altitude-1)
.set altitude to altitude/0.0065


Check the original post for more details on this one. You might need a longer USB lead to get the most out of this example but its still pretty cool

Simon

Finally I wanted to do something with Touch, so I build a game of "Simon". The computer flashes the Rainbow LED's in a sequence which gets longer each turn, and you have to copy the patten on the keypad.

make flotilla device

make rainbow flotillaRainbow device
make rainbowShade list of numbers
make rainbowColor list of numbers


make keypad flotillaTouch device 
make key1 boolean
make key2 boolean
make key3 boolean
make key4 boolean

make pattern list of numbers

when start
.repeat 5
..add 0 to rainbowShade
.
.add 0 to rainbowColor
.add 120 to rainbowColor
.add 240 to rainbowColor
.add 60 to rainbowColor
.
.tell rainbow to "update"
.
.forever
..broadcast playGame and wait
..wait 5 secs

This is standard flotilla setup. Then we have a list called "pattern" that we're going to store the pattern so far in. We put four distinct colours in the rainbowColor list, but turn all the LED's off by setting their brightness to 0. Then we're ready to go...


make counter number
make led number

when playPattern
.set counter to 1
.repeat length of pattern
..set led to item counter of pattern
..replace item led of rainbowShade with 10
..tell rainbow to "update"
..wait 0.3 secs
..replace item led of rainbowShade with 0
..tell rainbow to "update"
..wait 0.1 secs
..change counter by 1


To play the pattern we  simply loop over the list turning on the required LED of a short period with a smaller time gap between each.

when playGame
.delete all of pattern
.forever
..add pick random 1 to 4 to pattern
..broadcast playPattern and wait
..
..set counter to 1
..repeat length of pattern
...set led to 0
...repeat until not led = 0
....if key1
.....set led to 1
.....wait until not key1
....if key2
.....set led to 2
.....wait until not key2
....if key3
.....set led to 3
.....wait until not key3
....if key4
.....set led to 4
.....wait until not key4
...if not led = item counter of pattern
....broadcast flash and wait
....stop script
...change counter by 1


To actually play the game we add a random led to the pattern so far then play it back. Now we need to check the the touch pad. We go through the pattern one step at a time and wait for a key to be pressed. We record the key press then wait for the key to be released.... This is important otherwise just touching one key would be recorded multiple times.

Then we check that the key pressed was the right one. If it wasn't we run a script called flash to indicate failure, and end the came. If we get to the end of the pattern then we go background, add another light to the sequence and keep going!


when start
.forever
..tell keypad to "update"
..set dummy to pick random 1 to 10
..wait 0.01 secs

You'll not that when I'm checking the buttons I'm not calling update. I need to keep calling it, otherwise the variables representing the keys will never change, but it would make the code messy, so instead I've got a separate script which just keeps calling update. (it also randomises the game by throwing away random numbers - I've talked enough about that in other posts).


when flash
.repeat 5
..delete all of rainbowShade
..repeat 5
...add 10 to rainbowShade
..tell rainbow to "update"
..delete all of rainbowShade
..repeat 5
...add 0 to rainbowShade
..tell rainbow to "update"

That just leaves flash which is pretty obvious.

Conclusions

And that's about it. So far I'm pretty impressed with the hardware. It's really nicely built, and the design allows for lots of expansion. Price wise its not cheap - the Medium kit with a dock and four modules is £39, but its not too bad. Based on the prices of the different sized starter kits I'd expect individual modules to cost between £5 and £10 (some costing more than others) when they become available. Many of the modules have arduino compatible equivalents that cost about £1, but that's from overseas suppliers. From a regular UK seller they'd cost about £4 so a couple of pounds extra to have something kid friendly and just plugs in and works is actually good value. For comparison LittleBits charge $18 for their temperature sensor!!! On the downside, having got the Medium kit up and running,  I want to do more with it than I can with just four modules, so I will need to get more modules...

Where the HW has real potential is for expansion. The design allows new modules to be added. There are currently 12 available, but I'm surprised the so called "pirates" at Pimoroni forgot to include a compass. A 16x2 LCD text screen would also be simple to add. Right now its a nice piece of fun, but wth an ever expanding range of modules at good prices, then this could be a really great piece of kit.

Tuesday, 17 November 2015

Release 23: (the not very exciting one)

Release 23 is out, and contains a bunch of fixes and a few new features.

We had some problems with the Release 22 for Windows build getting flagged by Windows Defender... In response we pulled all old versions from the downloads page, ran full virus scans on our windows machine, and rebuilt the zip files from scratch. However even though Windows reported no problems with the files, it did occasionally complain about the zip file containing those files. We're as confident as we can be that the files are clean, and we've run scans on everything in the current build and they're giving a clean bill of heath.


The most fun thing in R23 is that it lets you play back sound files. There's also support for 433MHz transmitters and receivers so you can turn stuff on and off by remote control. Finally we've got support for i2c PWM extenders, which you can use to drive up to 16 servos - we've got a big servo project coming up soon.

Check the Downloads page!

Monday, 12 October 2015

Release 22 (Sorry for the bugs in 21!)

Its Sniff release time again, and 22 squashes a few bugs in Release 21... Most of there are concerned with cross platform issues within the IDE, so you might not have encountered them depending on your platform (Mac users can be smug and annoying here... Linux had some low driver bugs while on Windows the delete key stopped working!).

However its not all internals stuff... we've got the source to an updated version of the IK demo we posted recently, and if you've got a Raspberry Pi (and who hasn't) now might be a fun time to turn it back on and play with the new camera API. This might work with other cameras on other Linux platforms, but it works best with a Pi Cam! We'll have a write up of that soon.

Head over to the Downloads page and get the update!

Wednesday, 9 September 2015

Release 21: Back to School

Release 21 is now live!

This contains a number of new devices, and improvements to some old ones. In particular we can generate G-Code to drive a laser cutter directly from Sniff. We'll be talking about that in the next few days, along with posts detailing each of the new features, but for now here's the highlights list:
  • GCode CNC support
  • SVG Support
  • Joysticks
  • Improved Compass Support (including MAG3110)
  • Improved editing in SniffPad
  • Load Cell support
Check the downloads page to grab Sniff21 for your system.

Saturday, 8 August 2015

The Unfortunately Named SniffPaint


One of the researchers we work with is interested in getting kids to design video games to explore social issues (a little like the Serious Play approach). Having worked with groups of children to develop their ideas he approached us to help help them actually turn those ideas into playable games.

This led us to develop the Sprite system we've posted about recently, which makes it easy to write simple Sprite based games in Sniff. In our initial classroom tests this worked really well, and a group of KS3 kids who had never used Sniff before were able to work through a series of exercises and get a working game in an afternoon.

We learnt a lot from that trial, and made a few changes to the Sprite system to make things easier. For example you can now tell a sprite to "move to", or turn by" rather than the more "programmer" style "moveTo" or "moveBy". Well D'uh! Of course that was obvious if you're a kid, but its hard for grown up programmers to remember what it was like to not be programmers. Programming like a kid, rather than like a middle aged guy is why we built Sniff, so we fixed it! The kids' way is better!


One of the things that was surprisingly hard for kids to do as actually make artwork for their games. You would think that this wouldn't be a problem - its 2015! We have a million tools for making images... well no actually we don't! If this was the 80's or 90's we'd have MacPaint or Windows Paint(aka Paintbrush). Now we don't. On Windows 10 "FreshPaint" is an optional "Freemium" install, and costs "from Free to £77.29". I've only spent a few minutes with the free version during which I've been offered several in-app purchases, but I've yet to see anything that actually involves drawing an image!

Of course at the other end of the scale you've got photoshop. While that may be a great tool (not convinced - looks clunky and badly designed!), its certainly expensive and complex. We wanted something that could

  • make basic, low res icons
  • ran on all platforms
  • be learnt in 2 minutes
  • load/save BMP
  • doesn't cost anything
There are some web tools out there that provide some of those features, but getting images out of the web and into the games in the right format was a clunky process.

So we build SniffPaint. It's written if Sniff of course! "Dogfooding" is a great development tool. By writing it in Sniff we get a tool that runs on all Sniff systems, develop and debug the language, and get a really cool demo of how flexible Sniff is. Sniff Paint is included in Sniff R20, both as an executable (just type sniffpaint) and full source (examples/Hosted/sniffpaint.sniff) so you can add your own features if you like. We built the tools using the tools we give you!


SniffPaint isn't going to scare adobe anytime soon! It's very basic, but based on the experiences of the "in house testing team" a 7 year old can produce exactly the sort of artwork we need after only a few minutes. It's not particularly tied to the Sniff code, so you can just use it on its own to generate images for any of your projects. You can even try an online demo version online - just remember the online demo can't save anything, as its running in a sandbox and can't access your real files!

Using SniffPaint

To get started, just click on a colour in the palette and then click a pixel in the canvas. When you're done hit save (hint - up down cursor keys work great in the load/save panel).

Default resolution is 46x46 pixels. This just happens to fit well with the screen size. Hitting HiRes will double the current resolution so you can add more detail. LoRes halves the resolution. 46x46 is a good size for small game objects, 96x96 is about right for larger characters. If you want a nice 8-bit look then design at low-res, and then size up when you're done!


At this resolution drawing a single pixel at a time produces the best results, but you can draw circles or lines by clicking the button, then clicking and dragging on the canvas. Selecting a tool like this is a "one shot" option, and you're dumped back into single pixel mode immediately. If you want to draw lots, use the keyboard shortcuts - just press the letter for the tool you want to select. Dropper allows you to select a colour from the canvas, and fill (sort of) fills areas.

New Internal Bitmap Support

Sniff paint is written in Sniff! In order to make Sniff Paint possible we improved support for bitmap images. Previously you could draw bitmaps on a display using tell display to "draw image" but pushing that file access functionality into the display code was always something that needed looked at, so we fixed it. "draw image" will be available for the next few releases, but gradually we're going to remove it from display devices.

We've now got a new "bitmap" device. It currently only works with the Window device but we hope integrate it so you can use it on any display in the future.

In SniffPaint the default canvas is 46x46 and black, which we can create with:

make canvas bitmap device

when start
.set displayColor to 000
.set displayX to 46
.set displayY to 46
.tell canvas to "new"

Then we can draw it by simply setting the position, and calling draw:

.set displayX to 10
.set displayY to 10
.tell canvas to "draw"

When you draw them bitmaps are automatically "keyed" to remove the background, so you don't need to worry about Alpha (we may add a way to control this inf the future, but the default 

To edit it, we can use 
.tell canvas to "set pixel"
.tell canvas to "set pixel"

Load and save work with BMP files - not the most up to date format, but simple and easy:
.set fileData to "myDrawing.bmp"
.tell canvas to "load"
.tell canvas to "save"

If you've loaded an image in it can be useful to know how big it is: 
.tell canvas to "get size"
.say join "width:"[displayX]
.say join "height:"[displayY]


The next plan is to use what we've built as part of a 2 day games jam that will take place in September, where groups of kids will build a game over a weekend. We'll announce more details later, but if you interested in taking part let us know.



Friday, 7 August 2015

Release 20: the Scratch2015AMS build


We're off to Scratch2015AMS next week (yey!), so we've been getting everything ready. Among other things that meant copying Sniff onto lots of USB sticks (thanks to the Centre for Digital Entertainment for the very nice USB sticks - they'll be up for grabs next week). It seemed a bit silly to be giving out R19 as we've added loads of cool stuff since then, so that sort of forced the schedule on Release 20. There's a few things in there that are still works in progress, but there's too much good stuff not to take it to Amsterdam.

Key features:
  • Improved Tell notation using spaces
  • Improved Diagnostics (for Tell)
  • SniffPaint
  • Foundation work for MBED
  • Bug fixes

"Tell" is Sniff's way of interacting with external libraries. We write low level code in C then expose it through nice friendly API's. However when things didn't go right, they went badly wrong - telling a device to do something it didn't understand exposed some low level diagnostics that weren't pretty - now they don't. We've also let you include spaces in Tell commands, so instead of telling a sprite to "moveTo" you can tell it to "move to". The old way still works, but the new way is much prettier, and more Sniff like

We've been testing and working with the Sprite code for a while now, but one of the problems was the hoops we had to jump through to make a simple image. What happened to Mac Paint, and Windows Paint.exe (its a freemium feature in win10!)? So we wrote SniffPaint - a simple icon editor that we can use to make sprites, and of course its written in Sniff.

We've also started working on MBED support. This is a whole group of ARM based boards, which happens to include the BBC MicroBit. When we eventually get our hands on one, it should be pretty easy to add support for it. We've been testing with the Nucleo STM32F411 which is really nice and really cheap. STM make a whole range of demo boards for their ARM chips, and sell them for £10. The 411 is one of the more powerful, and it pretty ideally suited to running Sniff. The actually code works great on MBED, but setting everything up is hard work. We should be able to set things up more easily for the MicroBit rather than trying to work with all MBEDs. If you've got an MBED and you'd like to try it with this release get in touch - we'd love to work with you and support as many boards as possible.

Check the Downloads page to get your hands on the new code!

Sunday, 5 July 2015

Release 19: Sniff games on the web

It's time for another Sniff release, and this time we've got three great headline features. We'll be covering them in more depth over the next couple of week, but you can download and try them now:

Sniff on the web: We've added a new command "jsniff" which will compile your Sniff programs in to JavaScript. This means you can take code written in Sniff, and run it in a web page. It even runs pretty well on an iPad or iPhone. You can use the standard "window" device to do drawing, and check the keyboard and mouse.

Sprites! Sniff has so far been a sprite free zone - perhaps we were Sprited out from too much Scratch. However we love to write games, so ultimately we needed to support some kind of sprites. We now do this in the form of the "sprite" and "spriteManager" devices. These don't behave quite like the Scratch sprites you know and love, as Sprites are part of the Scratch language, while here they're a device (library), but you can do all the things Scratch sprites can do, and a whole lot more. Check out our Asteroids game (source is in the examples folder - and yes it works on the web!).

Leap Motion: You know its a pretty cool release, when support for the leap motion hand tracking device only makes 3rd on the feature list! You can now track your hands in 3D space as you wave them around over your keyboard.  Of course the first thing we did was teach teach it to recognise rock/paper/scissors.

As usual we've got two download packages:
Windows:Sniff 19w Release
Mac/Linux/Pi: Sniff 19 Release

Monday, 26 January 2015

Release 14: The Parallax Propeller

It's time for another release of Sniff!

The headline feature this release is that we can now compile for the Parallax Propeller chip. This is a pretty cool CPU designed with education and hackers in mind. It's main feature is that it has 8 cores!!! So far Sniff can only use a few of those, but in the future we hope to make more use of them. Also pretty neat is that its available in a standard old-school 40pin package, so you can build your own machine on breadboard (details later). Parallax are based in the USA, and as a small company haven't really broken into the European market (as far as I can tell), and the boards aren't that common in the UK, so if you're using one we'd love to hear from you.

To use propeller with Sniff, install the Parallax SimpleIDE first, then just use prop-sniff.

The other big feature is that windowing now works natively on OS X, which most signifigantly means that the sniffpad side (Which is written in Sniff) works on OS X too.

For those of you working at the lower hardware levels, we've introduced a new timer: Timers are difficult! On Arduino there are two methods of getting the current time: micros() and millis(). The problem is that millis() fails after about an hour, while micros() can run for weeks, but is less accurate. For data logging you want millis(), while for low level hardware you want micros(). We've tried it both ways, but there's always been gotcha's. Now we have "timer", and "fast timer". They both return the time in seconds, but fast timer is more accurate, while timer works for longer time periods.

There are also a bunch of other improvements and fixes. Let us know how you get on, either on the forum, or by emailing us.

Ian@dctsystems.co.uk

Release 14 for Linux/Mac
Release 14 for Windows

Monday, 8 December 2014

Release 13 - for Xmas projects!

Release 13 is now available for download from the downloads page!

It includes some minor tweaks and fixes. It also includes source for the BU Xmas tree project.

It also includes support for WS2801 type neoPixels which use data and clock pins. There are some great devices out there that use this type that are perfect for xmas decorations. If you're using ws2811 type, then you'll now need to create them using:

make neoPixel ws2811 device 2

The code should then work as before.

Friday, 7 November 2014

Release 12: Sniffpad -the Sniff IDE, written in Sniff!

Sniff's come a long way really fast since we initially started developing it, but two really important things things have been on the TODO list since day 1. Getting a version running on Windows as something we knew was important, but getting the resources to develop it held things back until last month when we finally released version 11 for windows.

We're excited now to be able to be able to tick off the other big outstanding feature: Sniff now has an IDE! Getting an IDE running was tricky because, while writing command line code that will run on Mac, Linux and Pi is relatively easy (Windows is a bit harder, hence delaying Win32 Sniff), every platform has its own way of drawing on the screen. It's really hard to write a program which draws on the screen which runs without modification on lots of platforms. There are tools to make it easier, but they're not ideal, and often require the end user to install libraries and the like.

We wanted something that was simple, lightweight, and ran on all the platforms that Sniff ran on... We were stuck. Then last month as part of the win32 work, we wrote a Sniff device that could open a Window. Originally it was intended to be just an alternative to the Linux frame buffer device, but once it was working on win32 and X11, there was a lightbulb moment...

We could write the Sniff IDE in Sniff!

It was perfect - by definition Sniff runs on the platforms we want to run the IDE on! Not only that, but it would demonstrate that Sniff was actually pretty powerful, and could do "real" programming. Developing a program like that would shake bugs out of the system (we found a couple of bugs, and tightened a few other things up), and best of all once we released it, if you don't like it you can add feature yourself, because its WRITTEN IN SNIFF!

And here it is! It runs identically on Windows and Linix (including Pi). It will also run on Mac, but requires X11 to be installed, which isn't ideal - we're looking at how we can fix that!

Install and setup Sniff as usual, then cd to the directory you're using to keep the code in, and type "sniffpad", and off you go.

On the toolbar on the top are buttons to load and save. These bring up a dialog panel, where you can type in a new filename. You can also use up/down cursor keys here to scroll through existing files, which turns out to be pretty neat.

To run your code on the computer, first you need to compile it using the compile button, then run it with the run button. If "run" doesn't work on a Linux machine then check you have "xterm" installed. It's pretty standard so you should be able to install it using "apt-get" or "yum" if you don't have it already.

If you want to work on Arduino, you can use the next button to complile/download. The terminal opens a companion program "sniffterm", which talks to the arduino via the serial port. This is handy even if you don't use sniffpad.

Finally you can quit, which asks you if you want to save first.

That's really all there is to it! It's pretty basic, but its not really intended to be a full blown IDE - its for writing simple programs and getting them running - most of the Sniff examples are less that 30 lines of code, so fit on a single screen. Unlike the Arduino IDE we don't intend this to be the main dev tool for everyone - Sniff is command line based, and this is a layer on top. Use whichever works for you (and if you want to, use Eclipse, or Xcode to edit Sniff code!). On the other hand if you think there's something missing (copy and paste is the on thing we will be adding soon), then you can load the source for sniffpad up in sniffpad itself, and make it better!

As before Release 12 comes in 2 flavours:
Win32 Sniff includes only windows files, and uses DOS cr/lf
Generic Sniff includes all platforms with Unix style text files