Sniff is a perfect language for making things with your Microbit. It's easy to get started with, because if you've used Scratch you've already learnt almost everything you need to know about Sniff. Scratch is an amazing system for Primary school children to learn programming, but when they move up to KS3 (Yr7) its starting to look a bit limited - the cat we once loved when we were 7 years old isn't cool now we're in "big school".
However that cat has taught you a LOT about programming, which you can still use. You've probably noticed that once you get the hang of it Scratch is really slow to use because it takes forever to find the blocks you're looking for, when you could just type in what you need far faster. Sniff is about wrapping all that up - just write down what your Scratch program would be as text, and Sniff turns it into something you can run on your Micro:bit!
when start
.forever
..say "This is Sniff"
..wait 1 secs
To get started you'll need to download Sniff, and install it. On Mac or Linux that's really easy - just download it an unzip it. On Windows you need to install a few things first, so check out our step by step instructions. To use Sniff on Micro:Bit you'll also need to install "Yotta" from mbed.org (update: MBED have dropped Yotta so 6months after getting all their customers to adopt it they're pretending it doesn't exist!. Use the link, or google to find the original pages, as they're very hidden on the MBED site)
Once you've got it working, you're ready start! We've got a set of tutorials you can work through, that show you how to use the features of the Microbit from Sniff (hint: each session would be suitable for a one hour classroom session). By the end of it you'll be confidently programming using text instead of blocks!
Sniff from Scratch
Sniff from Scratch#2: Moving to Microbit
Once you've worked through these, check out the other 150+ posts here on the Sniff blog, which contain loads of ideas for experiments and neat projects you can do using Sniff and your Micro:bit
Amazing project. Is there any book or document about the Sniff language? Specially to work on microbit? Thanks
ReplyDeleteIf you download the package theres a doc's folder which includes a PDF manual which includes a tutorial. The folder also has some specific documentation relating to some of the libraries.
ReplyDeleteFor specific hardware, check the examples folder which contains many examples for each type of platform. Most of the examples are covered here in the blog too.
any specific questions just drop me an email
Hi, I am trying to run my first Micro:Bit Sniff program and I am getting the following error. It looks like a conflict between the Sniff headers and ArmMBED stdlib?
ReplyDeleteI am on macOS Sierra 10.12.1
$ mb-sniff blink.sniff
In file included from /usr/local/Cellar/arm-none-eabi-gcc/5-2016-q3-update/arm-none-eabi/include/stdlib.h:11:0,
from /Users/amcguign/Projects/SniffR29Release/lib/sniffDefs.h:21,
from /Users/amcguign/Projects/SniffR29Release/lib/runtime.c:1,
from blink.c:3:
/Users/amcguign/Projects/SniffR29Release/lib/sniffDefsMBED.h:7:16: error: conflicting types for 'rand'
#define random rand
^
/usr/local/Cellar/arm-none-eabi-gcc/5-2016-q3-update/arm-none-eabi/include/stdlib.h:140:5: note: previous declaration of 'rand' was here
int _EXFUN(rand,(_VOID));
^
I commented out '#define random rand' in sniffDefsMBED.h and that got me unblocked, but there must be a better way ;)
ReplyDeleteaha! you're using a version of gcc that's been installed with Brew, rather than the one that came with MBEDOS4/Yotta. It should work, but it means the libs you're using are slightly different from the ones that you're supposed to use with Microbit.
ReplyDeleteUnfortunatly MBED have dropped support for Yotta less than a year after abandoning their previous tool chain, and deleted all appearance of to from their website, so doing a "standard" install is tricky. It's really frustrating as only a 6 months ago I spent a lot of time moving sniff to USE yotta, as MBED said it was their build tool for the future.
If you have Yotta installed from then you should be able to nudge sniff to using that version of gcc by removing the Brew version from your path before initialising Sniff.
Well this has certainly been a fun evening ;)
DeleteI'd installed Yotta and ARMmbed at Dojo this morning using the OSX homebrew instructions here: http://yottadocs.mbed.com/#installing
The key line of course is "brew tap ARMmbed/homebrew-formulae". Clearly the latest version referenced in this formula was breaking my builds and needed rolled back to a compatible version. For good measure I also downloaded the packaged yotta.app (563MB, srsly?). When I looked into this app's contents I found the clue: /Applications/yotta.app/Contents/Resources/prerequisites/gcc-arm-none-eabi-4_9-2015q3
So after some frustrating rounds of fixing a couple of annoying things about Homebrew (git fetch --unshallow; export HOMEBREW_NO_AUTO_UPDATE=1) I managed to rollback to an older formula and brew install a version of arm-none-eabi-gcc that was compatible with SniffR29.
And more importantly - PIN IT !! (my day job involves explaining to developers why their broken CI jobs are not my fault but because they didn't pin their python dependencies, but that's another story...)
$ brew list --versions --pinned
arm-none-eabi-gcc 5.0-2015-q4-major
Great you got is sorted out. Sorry for the hassle.
ReplyDeleteWith the Yotta app, the were moving towards a single package which did everything. While there were issues with the 'all in one' approach, it did mean there was a single, fixed toolchain. They've now moved to MBED-CLI, where the approach is "download a compiler from somewhere", so keeping everything in step is difficult.