We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm not sure where the problem is, here my code:
#include <LwIP.h> #include <STM32Ethernet.h> #include <EthernetUdp.h> #include <OSCMessage.h> #include <OSCBundle.h> #include <OSCData.h> byte mac[] = { /* ... */ }; byte ip[] = { 192, 168, 0, 222 }; const unsigned int port = 9999; byte outIp[] = { 192, 168, 0, 250 }; const unsigned int outPort = 9999; EthernetUDP Udp; OSCErrorCode error; long previousMillis = 0; void setup() { Serial.begin(115200); Ethernet.begin(mac, ip); Udp.begin(port); } void led_handler(OSCMessage &msg, int patternOffset) { // do something Serial.println("received!"); } void sendBundle(int ch) { OSCBundle bundle; char address[32]; sprintf(address, "/led/%u", ch + 1); bundle.add(address).add((int32_t) 1).add((float) 0.05); Udp.beginPacket(outIp, outPort); bundle.send(Udp); Udp.endPacket(); Serial.println("sent!"); } void processOSCMessage(void) { OSCBundle bundle; int size = Udp.parsePacket(); if (size > 0) { while (size--) bundle.fill(Udp.read()); if (bundle.hasError()) { error = bundle.getError(); Serial.print("error: "); Serial.println(error); } else { bundle.route("/led", led_handler); } } } void loop() { processOSCMessage(); unsigned long currentMillis = millis(); if(currentMillis - previousMillis > 5000) { previousMillis = currentMillis; sendBundle(1); } }
Every 5 s it sends out the UDP packet, but it can receive incoming packets until the first one is sent. After, it doesn't receive anything anymore.
The text was updated successfully, but these errors were encountered:
Use 2 different EthernetUDP variables. One for udp packet input and one for udp packet output.
EthernetUDP UdpIn; EthernetUDP UdpOut;
Sorry, something went wrong.
No branches or pull requests
I'm not sure where the problem is, here my code:
Every 5 s it sends out the UDP packet, but it can receive incoming packets until the first one is sent. After, it doesn't receive anything anymore.
The text was updated successfully, but these errors were encountered: