/oscuino

OSC implementation for the Arduino Platform

Primary LanguageArduino

OSCuino is a full-featured implementation of the OSC 1.0 communication protocol for Arduino.

Features:

- Supports the four basic OSC data types (integers, floats, strings, and blobs)
- Send and receive messages over any transport layer that implements the Arduino’s Stream - Class such as Serial, EthernetUdp, MIDI, and more.
- Address pattern matching
- Static memory consumption
- Compatible with Arduino 1.0 API and coding style
- 64-bit timetags

OSCuino is composed of two classes: oMESSAGE and oBUNDLE. oMESSAGE contains the address, type, and data and oBUNDLE is a bundle of oMESSAGEs with a timetag. To start sending data over the Arduino’s Serial port simply construct an oBUNDLE with Serial as the constructor argument, add some oMESSAGEs with some data, and send it off:


#include <oMESSAGE.h>
#include <oBUNDLE.h>
#include <SLIPEncodedSerial.h>

void setup(){
   SLIPSerial.begin(38400);
}

oBUNDLE bndl(SLIPSerial); //using SLIPSerial as the transport layer

void loop(){
  bndl.addMessage("/analog/0").add(analogRead(0));
  bndl.addMessage("/analog/1").add(analogRead(1)); 
  bndl.send();  
  SLIPSerial.endTransmission();
}


////////////////////////////////////////////////////////////////////////

SLIPSerial

The source also includes an extension of the Serial object which sends and receives data using the SLIP encoding (you can read more about that here http://www.cse.iitb.ac.in/~bestin/btech-proj/slip/x365.html). This makes Max/MSP integration very simple using CNMAT's slipOSC object connected to the Serial object. The SLIPSerial object has the same methods as the Serial object except for an additional "endTransmission" method which transmits the "End Of Transmission" character (octal 300) which is the message delimiter for the SLIP encoding. 

////////////////////////////////////////////////////////////////////////

Installation

Place the contents of the "src" folder into a file titled "libraries" inside of your Arduino Sketch search path. After restarting the Arduino IDE, those libraries should be visible under the menu Sketch->Import Library. 

For the Max/MSP examples to work, you'll need to download the odot objects available at http://cnmat.berkeley.edu/downloads/odot (sorry Mac only right now) and the CNMAT Everything download http://cnmat.berkeley.edu/downloads