-
Notifications
You must be signed in to change notification settings - Fork 38
[Q] Writing a HTML/Javascript to control the car from a browser #6
Comments
That's a good idea, I like it! I'm pretty sure it's not possible to send UDP packets from JavaScript, but you should be able to send TCP packets using WebSockets. I have some time this weekend so I'll try to add TCP support to the server and add a sample page to the repository that you can use to send messages to the server to drive the var. I have an example of what messages that you send should look like in the README. I think for your car, you'll want to do something similar to this (I've left out the web socket setup stuff though, I'll get a full example done this weekend. Also, I haven't tested any of this code.):
|
Cool! Thanks! |
Managed to create a PHP script that does it, fixed a issue with pi_pcm crashing after a few commands, too - it'd crash after receiving a specific .json command. Here's the script |
Okay, I added WebSocket support to the server. If you start it with There is a bug where occasionally the decoding of the message from the browser will fail and the server will ignore the message. I have no idea what's going on with that, but I'll try to fix it later. I'll leave this issue open in the mean time. |
Oh wow! Thanks! I'll surely have fun with this nifty piece of html. |
Hi again,
Now that I have PI-RC working, is it possible to send UDP packets to the pi_pcm server from a web browser using Javascript? If so, what contents does the UDP packet contain exactly? Can you provide an example? Is it also possible for you to provide a simple Javascript that sends the packet?
I'm asking because I've written a web page for my current project which allows me to control a robot from my Nintendo 3DS and I think it would be awesome to create a page that works with Pi-RC too.
Thanks again!
The text was updated successfully, but these errors were encountered: