Showing posts with label Blockly. Show all posts
Showing posts with label Blockly. Show all posts

Sunday, January 3, 2016

GoBlockly Interpreter: An Interpreter for Blockly in Go

I've just published GoBlockly: an interpreter for the Blockly visual editor output written in Go. This is something I wrote as part of a larger project (reimplementing the Belphanior Butler in Go), but it was a reasonable-sized chunk to break off and polish. It passes Blockly's own unit tests and allows for addition of custom blocks.

Example output of a server running GoBlockly library
If you program in go and want to play around with Blockly as a UI for simple code authoring, feel free to try it out! It doesn't come batteries-included (i.e. you'll need to set up your own Blockly web client and send the code back-and-forth to the server in go), but Go makes it easy enough to write a web server that this should be straightforward.

Have fun! :)

Saturday, December 15, 2012

Making The Train Run On Time

I have a few INSTEON modules and a 2412N controller. I've been experimenting with home automation for awhile, and this year I thought I'd do something fun.

I unpacked the model train that goes under our family tree and connected the power box to an INSTEON lamp module. Using Belphanior, my not-quite-yet-fully-released home automation core, I wrote a short script that drives the train for a few seconds (timing is a little sloppy, as it takes several seconds for the 2412N to respond to HTTP requests from the 2412n servant, but it does the job).

"cycle train" script
"cycle train" script

With the script written, all I had to do was fire it every two hours. Fortunately, there is a Belphanior servant that can monitor an iCal-formatted calendar and notify the butler to run scripts in response to calendar events. I pulled up a Google Calendar that I keep for this purpose and populated it with a cycle of the train every two hours (except at night, to save power).

Belphanior calendar, showing "cycle train" command
Belphanior calendar, showing "cycle train" command


The result is shown below. I'm pretty satisfied with it; simple, but effective!