Arduino goes lambda!

Welcome to the public beta release of Snap4Arduino!

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.

Briefly, these are some Snap4Arduino strong and weak points:

The Good

  • 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

The Bad

  • Not compatible with S4A

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, Chromebook version that you can also use for 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:

Microsoft Windows

MacOSX

GNU/Linux (32 bits)

GNU/Linux (64 bits)

Chrome App (DEPRECATED)

Current version: 1.1.6 beta (rc), released on 21/06/2016

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:

  1. If you haven't already, download and install the Arduino environment by following the instructions on http://arduino.cc/en/Main/Software.
  2. Open the Arduino IDE, go to File → Examples → Firmata → StandardFirmata
  3. Connect your board to a USB port in your computer
  4. In the Tools menu, select the board version and the serial port where the board is connected
  5. Go to File and click on Upload

Snap4Arduino will now be able to interact with your board.

GNU/Linux

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.

MacOS X

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.

Microsoft Windows

Just unzip the package and run the installer.

Chromebook

  1. Extract the experimental Chromebook package, a file called Snap4Arduino-chrome.crx will pop up
  2. Point your Chrome to chrome://extensions (paste this in your address bar)
  3. Drag and drop the Snap4Arduino-chrome.crx file from your file system into your Chrome, into the chrome://extensions tab
  4. Chrome will tell you the extension needs you ti give it permissions. Those are for accessing the serial port and the file system, so that you can load/save files
  5. That's it! You'll find Snap4Arduino among your regular Chrome apps!

Other systems

The experimental Chrome app will (mostly) work on any other system. We've only tested it in a Raspbian system, but it should work wherever you can install Chromium or Chrome. Once you've got Chromium/Chrome working, refer to the Chromebook install section.

Happy prototyping!

Show me the cool stuff

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

A line follower with parking lights

An ultrasound ruler

Refer to this section for info on how to use ultrasound sensors

An LCD screen

A command line application

A somewhat autonomous RaspberryPi powered bullseye contraption

An Etch-A-Sketch that streams itself to any device over the network

A shy Poppy Ergo Jr Robot

Music for a horror film of the 50s

A machine that beats you at Tic-Tac-Toe

A mechatronic teddy bear

A LOGO-turtle-like bluetooth drawing robot

I want to mess with your code

Sure, here's our GitHub repo:

Snap4Arduino@GitHub

Please feel free to send us your pull requests and participate in reporting, fixing or commenting on bugs!

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

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.

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.

Did I hear there's also a command line version?

Actually, there is! It's not yet completely functional, but it will work most of time.

Take a look at this GitHub repository and follow the instructions in its README.md file.

Who's behind this?

Snap4Arduino is being actively developed at Citilab by the Edutec Research Group:

Contributors

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.

Translations

  • 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

I found a bug!

I bet you did! Please take in account this is still a beta version. Bugs are hiding in the shadows waiting for you to find them, and if you do find one we would appreciate it so much if you reported it.

If you're a GitHub user, please use the official issue tracker. Otherwise, you can always fill up the following email template and send it to us. If you think it can help, you can also attach a screenshot.

Operating System:

Snap4Arduino version:

Steps to follow in order to reproduce the problem:

Additional notes:

Known issues

You can check out the status of all open issues in out official issue tracker. Please feel free to comment on them, and remember you can always contribute to the project by sending us a pull request.

Remember, this is a beta version we're building and maintaining in our very scarce free time, but we'll get there and fix all of these.