OSCuino Project Compilation Error

I am trying to follow a guide from trippylighting.com to get my board to connect to TouchOSC. I've tried to write my own version to use wifi as I am on an ESP32 WROVER and got the following error:

In file included from c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCBundle.h:29,
                 from C:\Users\Jacob\AppData\Local\Temp\.arduinoIDE-unsaved2025031-22804-155set5.fo36\sketch_jan31b\sketch_jan31b.ino:4:
c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCMessage.h: In instantiation of 'OSCMessage& OSCMessage::add(T) [with T = int]':
C:\Users\Jacob\AppData\Local\Temp\.arduinoIDE-unsaved2025031-22804-155set5.fo36\sketch_jan31b\sketch_jan31b.ino:66:13:   required from here
c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCMessage.h:136:31: error: call of overloaded 'OSCData(int&)' is ambiguous
  136 |                 OSCData * d = new OSCData(datum);
      |                               ^~~~~~~~~~~~~~~~~~
In file included from c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCMessage.h:29:
c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCData.h:106:5: note: candidate: 'OSCData::OSCData(boolean)'
  106 |     OSCData  (boolean);
      |     ^~~~~~~
c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCData.h:102:9: note: candidate: 'OSCData::OSCData(double)'
  102 |         OSCData (double);
      |         ^~~~~~~
c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCData.h:101:9: note: candidate: 'OSCData::OSCData(float)'
  101 |         OSCData (float);
      |         ^~~~~~~
c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCData.h:100:5: note: candidate: 'OSCData::OSCData(unsigned int)'
  100 |     OSCData (unsigned int);
      |     ^~~~~~~
c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCData.h:96:9: note: candidate: 'OSCData::OSCData(int32_t)'
   96 |         OSCData (int32_t);
      |         ^~~~~~~
c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCData.h:67:5: note: candidate: 'OSCData::OSCData(char)'
   67 |     OSCData(char t);
      |     ^~~~~~~
c:\Users\Jacob\Documents\Arduino\libraries\OSC/OSCData.h:57:7: note: candidate: 'constexpr OSCData::OSCData(const OSCData&)'
   57 | class OSCData
      |       ^~~~~~~

exit status 1

Compilation error: exit status 1

Even when I copied and pasted the example code I got the same error so I'm not sure what is wrong. I am a complete novice when it comes to Arduino and this is my first project. Any help would be greatly appreciated. I have attached the project code below (WiFi details obscured for security).

#include <WiFi.h>
#include <NetworkUdp.h>
#include <SPI.h>
#include <OSCBundle.h>
#include <OSCData.h>
#include <OSCMessage.h>

const char *ssid = "*******";
const char *password = "*******";

int serverPort = 8000;
int destPort = 9000;
int ledPin = 2;
int ledState = HIGH;

WiFiUDP Udp;

void setup() {
  Serial.begin(115200);
  Serial.println("OSC Test");

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected.");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  Udp.begin(serverPort);
}

void loop() {
  OSCMsgReceive();
}

void OSCMsgReceive () {
  OSCMessage msgIN;
  int size;
  if((size = Udp.parsePacket())>0) {
    while(size--) {
      msgIN.fill(Udp.read());
      }
    if(!msgIN.hasError()) {
      msgIN.route("/OnOff/toggle1", toggleOnOff);
      msgIN.route("/Fader/Value", funcValue);
    }
  }
}

void toggleOnOff(OSCMessage &msg, int addrOffset){
  ledState = (boolean) msg.getFloat(0);
  OSCMessage msgOUT("/OnOff/toggle1");

  digitalWrite(ledPin, ledState);

  msgOUT.add(ledState);
  if (ledState) {
    Serial.println("LED on");
  }
  else {
    Serial.println("LED off");
  }

  ledState = !ledState;		 // toggle the state from HIGH to LOW to HIGH to LOW ...

  //send osc message back to control object in TouchOSC
  //Local feedback is turned off in the TouchOSC interface.
  //The button is turned on in TouchOSC interface whe the conrol receives this message.
  Udp.beginPacket(Udp.remoteIP(), destPort);
  msgOUT.send(Udp); // send the bytes
  Udp.endPacket(); // mark the end of the OSC Packet
  msgOUT.empty(); // free space occupied by message
}

void funcValue(OSCMessage &msg, int addrOffset ){

  int value = msg.getFloat(0);
  OSCMessage msgOUT("/Fader/Value");

  Serial.print("Value = : ");
  Serial.println(value);

  msgOUT.add(value);

  Udp.beginPacket(Udp.remoteIP(), destPort);
  msgOUT.send(Udp); // send the bytes
  Udp.endPacket(); // mark the end of the OSC Packet
  msgOUT.empty(); // free space occupied by message
}

It appears the supplied library code is flawed. I can't try since those OSC libs are not standard, where did you get them. Using the code you posted, post the verbose error log in code tags.

Thank you. Reinstalling the library fixed the error.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.