Arduino-OSC is a fork of OSCuino, an Open Sound Control library for Arduino and Teensy boards developed at CNMAT at the University of California, Berkeley.

This forks provides a simplified API, focused only on the Arduino platform. It also includes a complimentary Processing library to communicate with the Arduino using OSC over the Serial port. The library is built on the excellent OscP5 by Andreas Schlegel. Both are intended to be consistent with OscP5’s usage patterns and object names.


Version 1 – September 2013
Arduino OSC

Get the source on Github.


To install the Arduino library, simply copy the contents of the ZIP archive into your Arduino sketchbook’s libraries folder.

To install the Processing library, first install OscP5 (either by downloading it or by using the Add Library menu). Then, navigate your the /libraries inside your sketchbook. Find the OscP5/library folder. Place OscSerial.jar into that folder, next to OscP5.jar.

When you are done, your OscP5 library folder should look like this



#include <OscSerial.h>
#include <EthernetUdp.h>
#include <SPI.h>  

OscSerial oscSerial;
long timer;

void setup() {
  pinMode(13, OUTPUT);

void loop() {
  // example of sending a message every 100 ms
  // avoid using delay() since it just blocks everything  
  long now = millis();
  if (now-timer > 100) {    
    OscMessage msg("/helloFromArduino");
    msg.add(0); // <-- this could be any data 
    timer = now;
  // important! 

void oscEvent(OscMessage &m) { // *note the & before msg
  // receive a message 
  m.plug("/led", myFunction); 

void myFunction(OscMessage &m) {  // *note the & before msg
  // getting to the message data 
  int value = m.getInt(0); 
  if (value == 0) digitalWrite(13, LOW);
  if (value == 1) digitalWrite(13, HIGH);
import oscP5.*;
import processing.serial.*;

Serial serial;
OscSerial osc;
String serialName = "the name of your serial port";

int led = 0;

void setup() {
  serial = new Serial(this, serialName, 9600);
  osc = new OscSerial(this, serial);
  osc.plug(this, "myFunction", "/helloFromArduino");

void draw() {

void keyPressed() {
  // send an OSC message
  OscMessage msg = new OscMessage("/led");

  if (led == 1) led = 0;
  else led = 1;


void plugTest(int value) {
  println("Plugged from /pattern: " + value);

// Any unplugged message will come here
void oscEvent(OscMessage theMessage) {
  println("Message: " + theMessage + ", " + theMessage.isPlugged());