I changed the ESPLineMApp.ino to add a count of received datagrams. I display that on the OLED instead of the content of the last message. I changed the UDP Joystick app parameter to delay 10ms between packets. That should send about 100/sec but the NodeMCU was only receiving about 17/sec, even when not attached to the line following car. Something somewhere was wrong.
But where - sender or receiver? One way to tell is with a different receiver. I wrote a simple Perl program to count received packets which I call count_datagrams.p, just to be obscure. I'll upload that soon.
Interestingly, count_datagrams.p running on an AMD FX(tm)-6300 Six-Core Processor counts about 85 datagrams per second. It does about the same running on a Raspberry Pi 2 B. Clearly the 17/sec shows a problem and also the app isn't really sending 100. Upon examining my ESPLineMApp.ino code closely, I found the last statement in the main loop() is "delay(50)" and I have NO IDEA what I was thinking of when I included that. After I comment out that statement completely, allowing the loop to run at the full speed the processor can do, I find about 80 datagrams per second are being counted. I'm happy with that improvement even though it seems to still miss a few. That could also easily be a result of the overhead of my counting code.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.