Hi everyone,
i was very delighted to find the OSC library for the ESP, unfortunatly there are some hefty timing/lag issues.
In preperation to connecting a MPU6050 accelerometer, I made this sketch, generating 6 tuples of random data (0-255)
Code: Select all#include <mem.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <OSCMessage.h>
#include <OSCBundle.h>
long sendCount = 0;
const char* ssid = "mynetwork";
const char* password = "mypassword";
// a instance of UDP to send and receive packets (udp, oviously!;)
WiFiUDP Udp;
const IPAddress outIp(192, 168, 1, 100); //ip address of the receiving host
const unsigned int outPort = 9001; //host port
void setup() {
Serial.begin(115200);
// Connect to WiFi network
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");
}
void loop() {
OSCBundle msg;
msg.add("/X").add((int32_t)(random(0,255)));
msg.add("/Y").add((int32_t)(random(0,255)));
msg.add("/Z").add((int32_t)(random(0,255)));
msg.add("/ax").add((int32_t)(random(0,255)));
msg.add("/ay").add((int32_t)(random(0,255)));
msg.add("/az").add((int32_t)(random(0,255)));
Udp.beginPacket(outIp, outPort);
msg.send(Udp);
Udp.endPacket();
msg.empty();
delay(100);
}
it runs smoothly for about 4-6sec then it starts lagging with delays up to 1,5seconds.
Im reading this with pure-data-extented @ the moment, but you can also see the lag in a network monitor. (e.g. iptraf under linux)
any ideas? Im kind of lost here.....
thx
oli