|
@@ -29,10 +29,19 @@ void printTest(OSCMessage &msg) {
|
|
|
|
|
|
Serial.print("OSC type : ");
|
|
|
Serial.println (msg.getType(0));
|
|
|
- sendOSC("/received", msg.getType(0));
|
|
|
+ sendOSC("/received", (int) msg.getType(0));
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
+void updatePotValue(OSCMessage &msg) {
|
|
|
+ // message /ESP_NAME/pot pot#[0..3] value[0..255]
|
|
|
+ potValueUpdate[msg.getInt(0)] = msg.getInt(1);
|
|
|
+ sendOSC("/updated", "pot" );
|
|
|
+ //Serial.print("update pot : " + msg.getInt(0) + " ");
|
|
|
+ Serial.println (potValueUpdate[msg.getInt(0)]);
|
|
|
+}
|
|
|
+
|
|
|
void setup_OSC(){
|
|
|
|
|
|
ipMulti.fromString(UDP_IP);
|
|
@@ -46,14 +55,15 @@ void setup_OSC(){
|
|
|
Serial.println(portMulti);
|
|
|
|
|
|
UDP.beginMulticast(WiFi.localIP(), ipMulti, portMulti);
|
|
|
- OSCMessage OSCmsg("/connected");
|
|
|
- for (int i=0 ; i<4 ; i++){
|
|
|
- OSCmsg.add(WiFi.localIP()[i]);
|
|
|
- }
|
|
|
- UDP.beginPacketMulticast(ipMulti, portMulti,WiFi.localIP());
|
|
|
- OSCmsg.send(UDP); // send the bytes to the SLIP stream
|
|
|
- UDP.endPacket(); // mark the end of the OSC Packet
|
|
|
- OSCmsg.empty(); // free space occupied by message
|
|
|
+// OSCMessage OSCmsg("/connected");
|
|
|
+// for (int i=0 ; i<4 ; i++){
|
|
|
+// OSCmsg.add(WiFi.localIP()[i]);
|
|
|
+// }
|
|
|
+// UDP.beginPacketMulticast(ipMulti, portMulti,WiFi.localIP());
|
|
|
+// OSCmsg.send(UDP); // send the bytes to the SLIP stream
|
|
|
+// UDP.endPacket(); // mark the end of the OSC Packet
|
|
|
+// OSCmsg.empty(); // free space occupied by message
|
|
|
+ sendOSC("/connected", 1);
|
|
|
}
|
|
|
|
|
|
void handle_OSC() {
|
|
@@ -67,10 +77,13 @@ void handle_OSC() {
|
|
|
//Declare valid OSC messages here
|
|
|
if (!OSCin.hasError()) {
|
|
|
OSCin.dispatch("/test", printTest);
|
|
|
- if (OSCin.match(ESP_NAME)){Serial.println("matched");}
|
|
|
+ if (OSCin.match(ESP_NAME)){
|
|
|
+ Serial.println("matched");
|
|
|
+ OSCin.dispatch("/ESP_TENS_*/pot", updatePotValue);
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
|