What is it?
If you know Berkeley Snap (BYOB) and Arduino, you might already have guessed this is a combination of both.
Snap4Arduino is a modification of the Snap visual programming language that lets you seamlessly interact with almost all versions of the Arduino electronic prototyping board.
A short example of what you can do with it:
Snap4Arduino is being built by the same team that developed S4A, with the collaboration of Ernesto Laval.
- Almost all Arduino boards supported (including Mega and Nano!)
- Auto-configurable pinouts so you can take advantage of your board's full capabilities
- Faster (7x!) response times than S4A
- You can interact with as many boards as you want at the same time
- Lets you Build Your Own Blocks™
- Desktop-based. No need for intermediate servers or middleware!
- Uses standard Firmata firmware
- Translation of simple scripts into Arduino sketches
- HTTP protocol for remote control and live-streaming of the Snap! stage
- Command line version for embedded GNU/Linuxes and all the hopeless geeks out there
Nice! I want to try it!
There are currently versions for GNU/Linux, MacOSX and Microsoft Windows available. There is also an experimental, not yet finished, web-based version that you can use for Chromebooks and other machines (Raspberry Pi, Beaglebone, Odroid, etc).
The project and all its components (including Snap!) are registered under public free software licenses (GPL and MIT), so you can download the sources and pretty much do whatever you want with them!
Please download the version that matches your operating system:
And how do I get it to work?
Snap4Arduino requires that you have StandardFirmata installed in your board.
To do so, follow these simple steps:
- If you haven't already, download and install the Arduino environment by following the instructions on http://arduino.cc/en/Main/Software.
- Open the Arduino IDE, go to File → Examples → Firmata → StandardFirmata
- Connect your board to a USB port in your computer
- In the Tools menu, select the board version and the serial port where the board is connected
- Go to File and click on Upload
Snap4Arduino will now be able to interact with your board.
You just need to unpack the package. The executable is Snap4Arduino.
In case it complains about a missing library, you can sudo run the postinstall.sh script, which will attempt to automatically take care of the issue.
If you would like to help us build packages for different distros, please don't hesitate to write to us.
Unzip the package and run the Snap4Arduino package. If you wish, you can move it to your Applications folder so you can access it as a regular app.
Just unzip the package and run the installer.
The experimental web-based version will (mostly) work on any system that can run Chromium or Google Chrome. Please refer to the project repository for more information.
Does device X work with Snap4Arduino?
Maybe. You can modify Firmata to have it work with a wide variety of devices that, by default, are not supported.
Check out this blog post if you want to do it yourself.
Additionally, we will be publishing a series of modified Firmata versions and their corresponding Snap4Arduino block libraries here, so if your device shows up under this list you can just download the extension and start prototyping:
User-contributed Firmata versions
Snap4Arduino comes with a built-in tiny HTTP server that mimics (and extends) the one Scratch 1.4 had.
This means you can control your Snap4Arduino application from any computer, mobile phone, tablet or any other network-enabled device in the same network.
In the following sections, the word IP refers to the IP address of the machine that has Snap4Arduino running on it.
Giving orders to Snap4Arduino
Point your browser to http://IP:42001/broadcast=MESSAGE
This will broadcast the message MESSAGE to Snap4Arduino, where you can capture it with a regular When I receive [message] block.
Updating the value of a Snap4Arduino variable
Point your browser to http://IP:42001/vars-update=VARIABLE-NAME=VARIABLE-VALUE
This will set the variable called VARIABLE-NAME to the value VARIABLE-VALUE.
You can also send a POST request to Snap4Arduino to update a variable.
Finding out which messages is Snap4Arduino listening for
Point your browser to http://IP:42001/send-messages
This will show a list of all message names for which Snap4Arduino has When I receive [message] hat blocks.
Finding out which variables are defined in Snap4Arduino
Point your browser to http://IP:42001/send-vars
This will show a list of all variables defined in Snap4Arduino, along with their current value.
Getting a real-time stream of the stage in Snap4Arduino
Point your browser to http://IP:42001/stage
This will render a real time version of what's going on in the stage. Like demonstrated in this video.
Ernesto Laval has been instrumental to this project. His uncountable contributions made the first beta versions possible, and he has been closely involved with us ever since.
Jens Mönig, the author of Snap!, has helped shape the project in so many ways.
Frank Hunleth contributed the 64b version.
Mareen Przybylla was one of our first early adopters. She has always been very active and helpful in our mailing list.
- Catalan: Bernat Romagosa
- Spanish: Ernesto Laval
- German: Mareen Przybylla
- Chinese (simplified): Steven Tang
- Italian: Alberto Firpo
- Hebrew: Lior Assouline
- Czech: Jan Tomsa
- Portuguese: Manuel Menezes de Sequeira
- Ukrainian: Yaroslav Kirov
- Russian: Yaroslav Kirov