Arduino goes lambda!

Snap4Arduino 8.1 released on January 8th 2023

Download desktop versions or play it online
Online needs a Chromium/Chrome/Edge browser with the Snap4Arduino Connector extension (download it or install it directly on your Chromebook)


Snap4Arduino is a Snap! extension. A full Snap! implementation that can interact with the physical world, through many types of electronic devices, especially those compatible with Arduino.


Snap! is a broadly inviting programming language for kids and adults that's also a platform for serious study of computer science. It is inspired by Scratch, written by Jens Mönig and Brian Harvey and presented by the University of California at Berkeley.


  • A full Snap! implementation: blocks-based, dynamic, live, concurrent, parallel programming...
  • Connecting to any Firmata compatible board: UNO, Nano, Mega, Leonardo, MIcro, Due, 101, ESP8266, NodeMCU...
  • Web version for Chromebooks and Chromium/Chrome/Edge browsers (Snap4Arduino connector required)
  • Desktop edition for Windows, GNU/Linux and MacOSX with extra Http server features
  • You can interact with multiple boards at the same time
  • Transpiling simple scripts into Arduino sketches
  • Free software licensed under the Affero GPLv3


Snap4Arduino requiere boards with Firmata firmware installed. Check devices section.

Desktop version

Just download, unpack/unzpip and click Snap4Arduino.

Choose your system: Windows 64 (or its portable option), GNU/Linux 64, MacOSX, Windows32 (or its portable) or GNU/Linux 32.


Install Snap4Arduino connector and then, just play Snap4Arduino online (you can install it as an app from the browser to run it offline).

Snap4Arduino online

Chromium/Chrome/Edge browsers are required

Download Snap4Arduino connector, unzip its crx folder, type chrome://extensions, select Developer mode and Upload an unpacked extension selecting that crx file (or just drag and drop it).

Just play Snap4Arduino online (you can install it as an app from the browser to run it offline).


The project and all its components (including Snap!) are registered under public free software licenses (AGPLv3 and MIT), so you can download the sources and pretty much do whatever you want with them!

Supported Devices

Snap4Arduino requires boards with Firmata firmware uploaded.

UNO boards

You can upload Firmata firmwares direcly from Snap4Arduino (with both desktop and online versions) to UNOs compatible boards. Or just here:

  • Be sure you are using Chromium/Chrome/Edge browser and you are under https
  • Plug your UNO by USB
  • Choose your firmware and just upload it!
Other 8 bit boards

A lot of devices support Standard Firmata. Tested on Nano, Mega, Leonardo and Micro.

32 bit boards

Many 32 bit devices support Firmata. Tested on Due, 101, ESP8266 and NodeMCU.

Firmata uploading

Standard Firmata is directly uploadable with any Arduino IDE.

Other options are: SA5Firmata, Creative Robotix Firmata, MC Firmata Collection, Robotics-unleashed, Snap4ArduinoDev, LCD Firmata and Ultrasound Firmata


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.

A bluetooth-controlled car (HOWTO: Blueetooth connectivity)
A line follower with parking lights
An ultrasound ruler
An LCD screen
A command line application (HOWTO: Command Line)
A somewhat autonomous RaspberryPi powered bullseye contraption (HOWTO: Command Line)
An Etch-A-Sketch that streams itself to any device over the network (source)
A shy Poppy Ergo Jr Robot
Music for a horror film of the 50s (source)
A machine that beats you at Tic-Tac-Toe
A mechatronic teddy bear
A LOGO-turtle-like bluetooth drawing robot (HOWTO: Blueetooth connectivity)
A mechatronic eye (source)
A Phiro robot
Two laptops communicating via Morse

Source Code

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!

HTTP Protocol


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.

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.

Updating the value of a Snap4Arduino variable

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).

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, as long as the message starts with the + character (other messages are private).

Getting variables and their values from Snap4Arduino

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.

Getting the value of a single variables from Snap4Arduino

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.

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 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.

Getting a snapshot of the stage in Snap4Arduino

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.

POST. Updating multiple variables of Snap4Arduino from an HTML form
<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">