11 Dec 2013

Webscale

I spent some time today putting together a simple web page that would allow me to send commands to Mirobot from a web page. I used Blockly to make a Scratch-like gui for composing your commands, then made a quick and dirty WebSocket <-> TCP proxy using Node.js so I could send them direct from the browser. I’m going to put the WebSocket handling into the Arduino eventually, so this is just a quick fix for now. One of the nice things about the WiFi module I’m using is that it has space onboard to embed some web pages, so I’ll be able to make a nice GUI that’s served from the robot itself.

I like the idea of being able to have parity between a few different ways of telling the robot what to do. Here we have a visual programming language which effectively compiles down to Javascript commands, which in turn just send LOGO to the robot. These layers of abstraction provide quite a nice way of gradually being able to expand your knowledge as it’s used for learning. You can see all three in this screenshot:

The code

One of the nice side effects of this is that you can now effectively program the robot in Javascript using the library I made directly, which should open up some really interesting opportunities for hacking and extending it. Websockets are also useful because they don’t have the same cross domain issues that regular HTTP calls would which mean they can be used from anywhere.