3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Mimbo - A Friendly Robot

Step 4Receive OSC Messages in Processing

Receive OSC Messages in Processing
Mimbo utilizes the accelerometer feature in TouchOSC to send it's acceleration sensor values back to the processing script.

In order to receive OSC messages, an interrupt/event handler method is required. The simplest way to debug OSC event handling is to simply printout whatever is received using code like this:

void oscEvent(OscMessage theOscMessage)
{
     println(theOscMessage.toString());
}


To get the value(s) of a message employ the following command in the oscEvent function:

float myVariable = theOscMessage.get(0).floatValue();

In the case of Mimbo, the OSC Event handler looks like this:

void oscEvent(OscMessage theOscMessage)
{
  // This runs whenever there is a new OSC message
  String addr = theOscMessage.addrPattern(); // Creates a string out of the OSC message
  if (addr.indexOf("/accxyz") != -1) {
    last_accx = accx;
    last_accy = accy;
    accx = theOscMessage.get(0).floatValue();
    accy = theOscMessage.get(1).floatValue();
    accz = theOscMessage.get(2).floatValue();
  }
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
6
Followers
3
Author:wkl
I'm a mechanical engineer with a passion for making things.