Snap! (formerly BYOB) is an extended reimplementation of Scratch that allows you to Build Your Own Blocks™. It also features first class heterogeneous lists, first class procedures, and continuations.
These added capabilities make it suitable for a serious introduction to computer science for high school or college students.
Snap! is presented by the University of California at Berkeley. It was developed by Jens Mönig, with design input and documentation by Brian Harvey and contributions by students at Berkeley and elsewhere.
Snap4Arduino requires that you have StandardFirmata installed in your board.
To do so, follow these simple steps:
The previous instructions cover the initial setup of your board. If your Arduino board comes with Firmata preinstalled or you have previously installed it yourself, you don't need to follow them again. Still, to prevent any possible issues with drivers (on Windows) or permissions, it may be a good idea to install the Arduino IDE anyway.
StandardFirmata is the basic requirement for a board to be reachable from Snap4Arduino, but you can get extended features by using others Firmata versions. See the Devices section for more information.
You just need to unpack the package. In most window environments you can just click on Snap4Arduino. If this fails, you can always run ./run from the command line.
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.
Online version requires a Chrome/Chromium plugin to connect to Arduino boards. To install it, just download the plugin package and unzip it. This will create a folder named crx. Then, go to chrome://extensions in your browser, activate the developer mode and drag and drop that folder into that browser tab.
If you prefer to run it offline or in your own server, use this downloadable version.
The embedded command line version works in any GNU/Linux based machine, including embedded platforms and single board computers. New generation Arduino boards like Yun, Tian or Industrial 101 can run this version right inside the board, and if you have a regular Arduino and any kind of Gnu/Linux based single board computer, you can always have the latter be the host computer to the Arduino board, giving autonomy to your project without having to modify your Snap4Arduino program at all.
Check out this section of our GitHub wiki.
Here's a couple of fun things that can be done with Snap4Arduino, most of them recorded on a Hi-Tech last generation potato camera.
You can find our GitHub repo at Snap4Arduino@GitHub. Please feel free to send us your pull requests and participate in reporting, fixing or commenting on bugs!
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:
From Citilab Edutec Team:
Also note that you can use any type of board (not just Arduino) as long as it can run Firmata. For example, ESP8266 and NodeMCU boards are being widely used with Snap4Arduino.
Additionally, other devices like Picaxe, micro:bit, Lego WeDo or Boost can also be used in Snap! (and thus in Snap4Arduino) by means of different middleware packages. Read more about it here.
Snap4Arduino libraries include SA5Firmata and Creative Robotix, which require their own 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.
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.
These public messages must begin with the + character. The rest of the messages are treated as private and thus are not accessible from the network.
Point your browser to http://IP:42001/vars-update=VARIABLE-NAME=VARIABLE-VALUE
This will set the global variable called VARIABLE-NAME to the value VARIABLE-VALUE.
This only works for global variables that start with the + character. Any other variables are not editable. Bear in mind that variables with names containing the '=' character can not be used, even though Snap! supports them.
You can also update multiple variables at once by means of a POST request (see below).
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, as long as the message starts with the + character (other messages are private).
Point your browser to http://IP:42001/send-vars
This will show a list of all global variables defined in Snap4Arduino whose name starts with the + or with the - character (variables starting with + are editable, while variables starting with - are only readable), along with their current value.
Point your browser to http://IP:42001/send-var=VARIABLE-NAME
This will return the value of the variable ready for you to use, no string manipulation needed. The variable must start with the + or - character to be accessible from the network.
Point your browser to http://IP:42001/stage
This will render a real time version of what's going on in the stage, like shown in this video.
You will be presented with an auto-refreshing HTML page, enabling you to watch the stage contents in your browser, though in a non-interactive way. You need to enable Public Stage from the settings menu for this to work. Otherwise, the stage is not accessible from the network.
Point your browser to http://IP:42001/stageimg
This will render a snapshot of the Snap4Arduino stage in the form of an image encoded in base64 that you can use for any purpose. You need to enable Public Stage from the settings menu for this to work. Otherwise, the stage is not accessible from the network.
<form action="http://IP:42001" method="post">
You can update multiple global variables in your project at the same time by means of an HTML form sent through a POST request.
By using <INPUT> and <TEXTAREA> tags, you can send all kinds of input types to Snap!, except for booleans. Their name attribute should contain the name of the variable you wish to update.
Note that Snap4Arduino expects all queries to be UTF-8 encoded. To make sure your query goes through properly, especially when dealing with special characters, you can always use:
<form action="http://IP:42001" method="post" accept-charset="utf-8">