Go Down

Topic: TouchOSC via Ardosc/Bonjour (Read 12944 times) previous topic - next topic


replace the :
Code: [Select]

Code: [Select]
  Serial.print("Value = : ");

And see what that does. That works in the example code I wrote. It's a bit shooting in the dark, however, if that works you've accomplished 2 things.

1. You know your openFrameworks code sends a valid float.
2. You know where the problem is in the Arduino code.



Jan 09, 2013, 01:51 am Last Edit: Jan 09, 2013, 01:57 am by Nixon123 Reason: 1
mh, only alive! in serial monitor. Nothing besides that.

i wonder if this has something to do with library problems, i had an ArdOSC library that was written for the Watterod RedFly wifi shield and i reinstalled this one for the Ethernet board to test the connection. mh but I removed the RedFly ArdOSC folder in my library path to avoid trouble... i think it's a very small problem. all the ports and ip settings seem to be okay. frustrating


What Arduino board are you using ?

I am asking because my sample code specifies :

Code: [Select]

On an Arduino Uno for example that would not work and I'd start with :

Code: [Select]

And don't forget to change that in the serial monitor as well ;-)

Also, perhaps, if your board has an LED pin you may want to start getting to turn the LED on and off. Then at least you know that you can send an receive a value.



Jan 09, 2013, 02:16 am Last Edit: Jan 09, 2013, 02:43 am by Nixon123 Reason: 1
Seems all to be ok, it's an arduino ethernet board i program with an usb2serial light adapter, the proper board is selectet,  the baudrates are the same. i just read that the build in led is on pin 9, i'm going to test if i can cahnge something, tried it before with an external led, but no luck.


First, I'm very thankful for your help, great community here.
Second, I solved it  :) or to be precise someone pointed me to a problem with the ofxOsc library and bundled osc messages, so it was related to Open Frameworks. Here is the link for everyone who runs into the same issues and stumbles over this thread

so long, nixon


Cool! Thanks for posting the openFrameworks part of it too. It's often ant these software interfaces where one gets stuck.

Or in Obi Wan's words "Be mindful of the Interface Luke'"  :smiley-mr-green:



Thanks HeadRoom and crew, this thread really got me unstuck.

I reserved DHCP IP on the router for the Arduino Ethernet Shield so I never have to change OSC settings on the iPad regardless what is connected.

Time to add the DMX shield and see if I can get that going too.  I also bought a seeed Studio WiFly.  Would like to ditch the router/EtherNet shield if I can.

Gratefully yours,


Replacing the Ethernet Shield with a WiFi shield will require some adaptions to the ArdOSC library. The ArdOSC library contains a few function calls to the lower level SPI functions of the Ethernet library.

I personally am not working with the ArdOSC library anymore as it is rather dated and not maintained anymore. I have rewritten my code to use the OSC library from CNMAT (Oscuino) https://github.com/CNMAT/OSC. It is writen and maintained by the inventors of the OSC protocol and actively maintained.
It uses the "regular" Arduino Ethernet and EthernetUDP libraries and is not directly hardware dependent. However, using hardware that can make direct use of the the Arduino Ethernet libraries is a not to be underestimated advantage to getting things to work very quickly.
For example I use a WIZ820io Ethernet module instead of the Ethernet Shield.

Any change in Ethernet related hardware will require you to change code in the used libraries unless the libraries that come with these shields e.g. the Seedstudio WiFi shield have compatible function calls.



Thanks for replying and I will investigate CNMAT.  Feel free to drop out of this thread.

I'm not at the Bonjour stage yet, and not sure why I would need it.  If anybody wants to tell me the advantages, I'm listening.

I couldn't find Headroom's TouchOSC template, so I made my own, but Pin 13 LED just blinks on -then- off immediately.  My TouchOSC template works, as the call to funcOnOff() is happening and I can see tx/rx LEDs working in TouchOSC on my iPAD. 

TouchOSC control is: /Eth_ArdOSC/toggle1

But Pin 13 LED just Blinks ON/OFF when I push the toggle.

My Serial Monitor is funky too (I added some debugs to Headroom's code):

Serial looks like this (I matched the baud rates):



Here's the code:
Code: [Select]
#include <SPI.h>
#include <Ethernet.h>
#include <ArdOSC.h>

//byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

// Me Mal Arduino Ethernet shield MAC address
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0xFB, 0xCF };

OSCServer server;
OSCClient client;

int serverPort = 8000; //Touch OSC Port (outgoing)
int destPort = 9000;   //Touch OSC Port (incoming)
int ledPin = 13;       //6 on a Teensy++2
int flag=0;

void setup(){
  Serial.begin(115200); //set your serial monitor's baud rate to 115200 or you won't be able to read the debugs
  Serial.println("DNS and DHCP-based OSC server");
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
  // print your local IP address:
  Serial.print("Arduino IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
  //start the OSCserver
  //add OSC callback function. One function is needed for every TouchOSC interface element that is to send/receive OSC commands.
  server.addCallback("/Eth_ArdOSC/toggle1", &funcOnOff);

void loop(){

     Serial.println("alive! ");

//When the button on the TouchOSC inteface is pressed, a message is sent from the iDevice
//to the Arduino to switch (togle) the LED on the Arduino on/off
//then a messeage is sent bak from the Arduino to the iDevice to toggle the buttom on/off

void funcOnOff(OSCMessage *_mes){
  float value = _mes->getArgFloat(0); //TouchOSC expects float values
  //create new osc message
  OSCMessage newMes;
  //set destination ip address & port no
  //added by me Mal 2013-09-21
  Serial.println("FLAG" + char(value));
    digitalWrite(ledPin, LOW);
    digitalWrite(ledPin, HIGH);
  //send osc message


You don't NEED Bonjour, but it is cool ;-)

I think I had the problem with the LED just blinking once too when I was figuring things out. IIRC the trick in TouchOSC is to use a toggle button (not a push button) and un-check the "local feedback" check box.

  • When you press the button once an OSC message is sent to the Arduino.
  • Then the LED is turned on.

  • then a message is sent back to the toggle button in TouchOSC to turn it on.




I did get the EtherNet and Conceptinetics DMX shields working with ArdOSC/TouchOSC/iPad. 

Support told me Ethernet shield requires pin 2,  so, connect middle pin of the Slave jumper on the DMX shield to Arduino Pin 7 and code to: DMX_Master dmx_master ( 100 , 7 );

No PWM gios sacrificed in this experiment.

Thanks again,


That's very good to hear. Congrats!


Go Up