Alternative Arduino Interfaces
ArduBlock
ArduBlock is a programming environment designed to make “physical computing with Arduino as easy as drag-and-drop.” Instead of writing code, worrying about syntax, and (mis)placing semicolons, ArduBlock allows you to visually program with an snapped-together list of code blocks.
ArduBlock builds on the simplicity of Arduino, and creates a perfect beginner gateway to physical computing. Instead of tearing your hair out debugging, you can spend your time creating!
Installing ArduBlock
ArduBlock is something of an "add-on" to Arduino, so it requires that you have the Arduino IDE installed. The benefit of that, though, is -- because Arduino is multi-platform -- ArduBlock works on Windows, Mac, or Linux. Plus, having Arduino already present makes the transition from visual programming to text programming easier, when the inevitability approaches.
Installing ArduBlock can be a little tricky -- there's no installer, just a Java file that needs to be stored in a very specific location. Follow the steps below to install it:
- Download and Install Arduino (if you haven't already) -- Ardublock is an extension of the default Arduino IDE, so you'll need to have Arduino installed on your computer to run it. Check out our Installing Arduino IDE tutorial for help with that.
- Download ArduBlock -- Click the link to the left, or head over to the ArduBlock Sourceforge page to find the latest and greatest version.
- Identify your Arduino Sketchbook location -- This is a folder on your computer where your sketches and libraries are saved by default. To find your sketchbook location, run Arduino, and open Preferences by going to File > Preferences. The contents of the top text box defines your sketchbook location. Memorize that location and close Arduino.
- Create [sketchbook]/tools/ArduBlockTool/tool/ -- The Ardublock file you downloaded earlier needs to live in a very specific location within your Arduino sketchbook. Navigate to your sketchbook, then create a nest of three directories: tools > ArduBlockTool > tool (watch out, each folder is case sensitive).
- Paste "ardublock-xxxxxxxx.jar" Into /tool/ -- Paste the Ardublock file you downloaded -- a JAR (Java ARchive) file -- into the last folder in the nest you created.
- Start Arduino -- Or restart it if it was open.
- Select the Board and Serial Port -- Just as you would if you were using Arduino, make your board and serial port selections from the "Tools" menu.
- Open ArduBlock -- Run ArduBlock by clicking Tools > ArduBlock. If you don't see an entry for ArduBlock here, double-check to make sure your directories are all correctly typed and cased.
ArduBlock works hand-in-hand with the Arduino IDE -- it relies on the IDE being open in the background, so don't close the Arduino window!
Using ArduBlock
The ArduBlock window is split into two halves. On the left there are "bins", which store every possible block you can add to your sketch. The blank, gray slate to the right of that is where you "draw" your sketch. To add a block to your sketch, simply drag it from the bin into the blank, gray area.
To begin, every ArduBlock sketch requires a Program block, which you can find in the "Control" bin. The Program block defines the setup
and loop
functions that every Arduino program requires.
From there, you can drag more Blocks over, snapping them into either the loop
or setup
sections. Here, try making a blink program. The set digital pin blocks, which effect a digital output (analogous to Arduino's digitalWrite
function), are found under the "Pins" bin. The delay milliseconds block, found under "Control", is analogous to a delay
Arduino function.
Then click Upload to Arduino to send your drawing off to your Arduino board. You can ALT+TAB back over to the Arduino window to check your code upload status.
After you've successfully uploaded your first sketch, continue to play around and explore the contents of the other bins!
ArduBlock Tips & Tricks
You can clone blocks, or groups of blocks, by right clicking and selecting "Clone". Everything from the block you right-clicked to the bottom of that "group" will be copied and pasted into the top-left corner of the window. This is a huge timesaver for bigger drawings.
You can temporarily remove code from your sketch by dragging it out of the entirety of the "Program" block. Anything not connected to the main Program block will be ignored when your code is compiled. This is a great debugging tool -- you can remove a block of code from program execution, while not actually deleting it, much like commenting out code.
Finally, if you peek back over at the Arduino window, after you've uploaded an ArduBlock drawing, you may notice something different. To create your code, the ArduBlock program simply parses your blocks and spits the equivalent Arduino code over into the Arduino window.
This becomes a great learning tool if you're interested in transitioning from graphical programming to text.
ArduBlock Resources
- ArduBlock Homepage
- ArduBlock GitHub Repository (Open Source!)
- SparkFun Digital SandBox Experiment Guide -- A series of Arduino experiments all based around ArduBlock.