Skip to content

Instantly share code, notes, and snippets.

View julioterra's full-sized avatar

Julio Terra julioterra

View GitHub Profile
@julioterra
julioterra / spacebrew_collab_arduino_forwarder.pde
Last active August 29, 2015 13:56
Spacebrew Collab: Arduino Forwarder Example with Custom Type
import spacebrew.*;
import processing.serial.*;
// define the spacebrew server location, app name and description
String server = "sandbox.spacebrew.cc";
String name = "give me a SHORT NAME PLEASE!";
String description = "This is an example client which publishes the value of a analog sensor from an Arduino ";
Spacebrew sb; // Spacebrew connection object
Serial myPort; // Serial port object
@julioterra
julioterra / rainbow_SB.pde
Last active December 22, 2015 08:29
This is the rainbow sketch with the Spacebrew library fully integrated.
/**
* Rainbow.
* Click the mouse anywhere on the sketch to activate the rainbow animation.
*
*/
//////////////////////////////
import spacebrew.*;
Spacebrew spacebrewConnection;
@julioterra
julioterra / rainbow.pde
Last active December 22, 2015 03:18
This is the base sketch for the Spacebrew workshop at NYC-CHI event on 9/5.
/**
* Rainbow.
* Click the mouse anywhere on the sketch to activate the rainbow animation.
*
*/
int barWidth = 20;
int barCurrent = 0;
int barTotal = 0;
boolean drawingRainbow = false;
@julioterra
julioterra / spacebrew_passtheball.pde
Last active December 18, 2015 23:39
This is an adaptation of the Processing bouncing ball example for Spacebrew. It passes the bouncing ball from one sketch to the next.
/**
* Spacebrew Bass the Ball
*
* Sketch where a ball goes across the screen and get's passed to
* another sketch. Sketches are connected using Spacebrew.
*
* Developed for Spacebrew workshop at ITP Camp 2013.
*
* Sketch based on Bouncing Ball Sketch developed by Dan Shiffman
* for Nature of Code.
@julioterra
julioterra / led_strip.pde
Created May 9, 2013 03:03
Processing sketch for the Spacebrew LED strip tutorial.
import spacebrew.*;
import processing.serial.*;
Serial port;
Spacebrew spacebrewConnection;
String server="sandbox.spacebrew.cc";
String name="ArduinoLEDRangeOutput";
String description = "Physical LED bar. Send me a number and I'll graph it.";
@julioterra
julioterra / led_strip.ino
Created May 9, 2013 02:43
Arduino code for Spacebrew LED Strip tutorial.
#include "LPD8806.h"
#include "SPI.h"
// Number of RGB LEDs in strand:
int nLEDs = 32;
// Chose 2 pins for output; can be any valid output pins:
int dataPin = 4;
int clockPin = 5;
import spacebrew.*;
import processing.serial.*;
String server = "sandbox.spacebrew.cc";
String name = "PhotoCell_Publisher_" + floor(random(1000));
String description = "This is an example client which publishes the value of a photocell connected to an Arduino ";
int bright = 0; // the value of the phtocell we weill send over spacebrew
Spacebrew spacebrewConnection; // Spacebrew connection object
void setup() {
// open serial port
Serial.begin(9600);
}
void loop() {
// read and send the value of analog sensor
long raw_val = analogRead(A0);
// use to adjust the range, if necessary
@julioterra
julioterra / clawdia_lives.pde
Created April 9, 2013 05:29
Processing sketch that connects to Arduino clawdia_lives.ino sketch to Spacebrew. From clawdia tutorial.
import spacebrew.*;
String server="sandbox.spacebrew.cc";
String name="Meet Clawdia";
String description ="This is a client that connects to ";
import processing.serial.*;
Serial myPort; // Create object from Serial class
boolean serial_connected = false;
@julioterra
julioterra / clawdia_lives.ino
Last active December 15, 2015 23:49
This is the Arduino code for the Clawdia Spacebrew tutorial.
#include <Servo.h>
// CONSTANTS - keys for parsing messages via serial
#define GRAB 'G'
#define SWING 'S'
#define ROTATE 'R'
#define ANALOG_GRAB 'A'
// CONSTANTS - message length, servo count, and debug
#define MSG_LEN 16