davidbuckley.net |
home | 19 December 2023 |
A few weeks ago a friend was wanting to create a browser based control panel for a 1980s Tomy Omnibot 2000 he was refurbishing.
The examples on the web and the Arduino examples WiFi Web Server, WiFi Web Server LED Blink, didn't do what we wanted. we wanted buttons that could be clicked on and off to control functions on the robot.
Having lots of buttons that when clicked executed <a href=....> refreshed the page and made everything blink as the page refreshed. Not nice.
Neither off us had done this before and OmniControl is the result of what we learned. Along the way we learned how to make buttons click on and off using javascript and EventListeners, we learned about javascript 'fetch' which is a lot simpler to use than the web would have you believe. And I found out about putting client.print strings in Raw strings R""""(...)""""; which means they are readable and easy to edit, even so editing OmniControl.htm and running that in a browser is a lot easier and quicker than editing & compiling & downloading to an Arduino & WiFi connecting to the Arduino then testing the edit.
The panel below is where we are at the moment. Buttons can be clicked on and off and commands sent to a robot. The example in this page doesn't actually do anything because the page was not served from an Arduino controlling a robot. When it is compiled for an Arduino and downloaded then providing instructions are written in the Arduino code to recognise and execute commands sent from the browser, the robot can be controlled.
The program takes about 40k in a Uno-WiFi-Rev2, and about 785k in a Wemos D1 R32.
To see the source code for this page, right click and select 'View Page Source'
|
|