The biggest prototyping challenges is in creating a robust network that enables communication across many devices (Arduino, iPhone, Processing, OpenFrameworks, web browser, etc).

SPACEBREW is an extremely powerful socked-based tool created by the wizards at Rockwell Labs to make your life easy.

I am going to create this Instructable to guide you (and me) through Spacebrew. This is my first time using it, so we might be on the same page :]

My goal for this Instructable is to create a series of super SIMPLE networks that showcase communication between OpenFrameworks, Processing, Rasberry Pi, web browser (Javascript), and Arduino.

You should have some coding experience before proceeding. I will not stop to explain all the coding fundamentals. Sorry, that would just take far too long. Without previous experience in Arduino/Web/Processing, you may find this Instructable a bit difficult.

I highly recommend reading the Spacebrew getting started guide before continuing this Instructable.

Step 1: Test1: Processing to Processing (With SPACEBREW)

Download the following: From the Spacebrew Processing library, copy the 'library/spacebrew' folder to 'documents/processing/libraries' (see image). If your on Windows, keep in mind, your Processing folder may be in a different location.

Open 'Instructables_Test1.pde' in Processing and read through the code.

Processing Code

You will quickly discover that this code is very simple. We created a publisher (outgoing data) called 'outgoing'. We created a subscriber (incoming data) called 'incoming'.
spacebrewConnection.addPublish( "outgoing", "boolean", false );
spacebrewConnection.addSubscribe( "incoming", "boolean");

When the mouse is pressed we send a message.
void mousePressed() { //mouse is pressed
spacebrewConnection.send( "outgoing", true); //send a boolean
When a message is received we toggle the background color.
void onBooleanMessage( String name, boolean value ){
println("got bool message " name " : " value);
current_color = !current_color;

RUN 'Instructables_Test1.pde'.

See the window that pops up and says 'main window' in red. Click anywhere on that window. Wow, nothing happens.

Now the MOST IMPORTANT part. Visit the Spacebrew sandbox: http://spacebrew.github.io/spacebrew/admin/admin.html?server=sandbox.spacebrew.cc. Scroll down to see the project 'Instructables / Fuzzy Test 1'. You should see two unconnected boolean nodes. Click each of them to connect (see image).

Now visit the Processing 'main window'. Click it, and if it is working, you should see the background color change between black and white. Wooooooo!

Connecting the nodes enabled us to send a message from Processing, to itself.

Your probably thinking, what a waste of time to make Processing talk to itself. And your right. The whole point of Spacebrew is to connect DIFFERENT things. In the next step, we are going to do just that.

About This Instructable




Bio: fuzzywobble.com
More by Fuzzy-Wobble:'90s Payphone Boombox Hack Teensy Monster v1.0 // DIY MIDI Controller Prototyping Wizardry With SPACEBREW 
Add instructable to: