Hi!
I am trying to communicate my Arduino with Reaper via OSC over Ethernet shield. While sending messages to Reaper is not a problem, recieving one properly bugs me a lot.
I am using Oscuino library from CNMAT.
When I am trying to recieve only /time message from Reaper I get this:
I pressed play at time 0.00 and it gets /time only sometimes.
When I change “/time” to “*” (everything) it looks like this:
As you can see, when using “*”, sometimes it gets other values than time.
This is the code I am using:
Ethernet shield is W5100
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <OSCBundle.h>
#include <OSCMessage.h>
#include <OSCMatch.h>
EthernetUDP Udp;
void TimeOSC(OSCMessage &msg);
IPAddress ip(192, 168, 5, 2);
const unsigned int inPort = 8000;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
void setup() {
Serial.begin(115200);
Ethernet.begin(mac,ip);
Udp.begin(inPort);
}
void loop(){
int size;
OSCMessage msgIN;
if ( (size = Udp.parsePacket())>0)
{
while(size--)
msgIN.fill(Udp.read());
msgIN.dispatch("/time",TimeOSC);
}
}
void TimeOSC(OSCMessage &msg) {
float time = msg.getFloat(0);
Serial.print("Time: ");
Serial.println(time);
}