Comments: WiFi Controlled Robot
Looking for answers to technical questions?
We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.
If you've found an issue with this tutorial content, please send us your feedback!
Hopefully the creator still reads this, I was wondering if the HTML code for the arrow keys can be made so multiple commands can be read and implemented at the same time. Currently 1 command can be used at a time. For example, if up arrow is pressed (moving forward), the vehicle cannot turn while moving. I have been fiddling with the code and haven't gotten it down. Any advice?
Hi there, it sounds like you are looking for technical assistance. Please use the link in the banner above, to get started with posting a topic in our forums. Our technical support team will do their best to assist you (this might be outside the scope of their service).
That being said, the code operates kind of like a simple "state machine". For example, it can only perform one operation at a time and it cannot perform another operation, while it is in the middle of its current operation. In simple terms, you would need to operate the device on both cores and setup an interrupt handler to do what you want, but that is way beyond the scope of this tutorial.
As a hint, the print statements are what controls the motor operations, like
Serial.print("M0F70\r\n");
.I have built this, using a Pi Zero W + V2 camera as the webcam, and configuring it to stream using the"motion" software package, although with motion detection turned off.
With no video, the keyboard control for the cambot worked very well. When I streamed video using the technique described in the blog and tutorial, the video worked great, but the response to the arrow keys became sluggish, and stop signals from key releases were almost always not picked up. I was using a Safari browser. Not yet sure how to make the keyboard action signals more robust.
I haven't yet played with the page refresh rate: 5ms may be on the fast side. And I should introduce a separate key dedicated to stopping the motors. But I wonder if there is a way to make detection of the keyup signal failsafe. It's the key releases that aren't being detected.