[ZeroBrane Studio] Re: best 2D game environment for a youngster?

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Mon, 2 Feb 2015 21:43:45 -0800

Hi Joe,

>> Going back 3.5 years, ZBS started as a Lua editor to debug Lua scripts
that were controlling a small Arduino-based robot (from a mobile device
atached to the robot; I was using an iPod at the time). I was looking for
something that I could run step-by-step on the device (from a desktop) so
that kids/students would see how the robot can react and be controlled by a
script.

> Can you tell me more about this?  I've got a Redpark iPhone serial
adapter, and plenty of Arduino (and other) robots around, but haven't yet
put them together.  I thought I'd have to write the code in Cocoa/ObjC,
which is a bit deep into the unpleasant zone for me (and way beyond what I
would subject my son to).

I was actually using a wifi shield for Arduino to connect to the device
(even though the device was attached to the robot). It was possible to
connect with a serial adapter, but for any distribution it was necessary to
get certification, so I didn't want to pursue that route.

I was using RedFly wifi shield (quite expensive, was $75 at the time) and
wrote DNS and DHCP servers in C for Arduino (
https://github.com/pkulchenko/DHCPLite) to allow new devices to use their
own adhoc network (the users could then configure the device to connect to
their existing network). It was all working quite smooth: you'd turn the
robot on, connected to its network, go to its domain address in the browser
(different for differently named devices) and get a configuration page
where you'd enter the address of your network. After you submit the device
would restart with the new configuration and would connect to your network.
There is an example in the github repository that does all this (minus some
setup to pre-configure domain names).

After the device is connected, you'd then run MobileLua application (
https://github.com/pkulchenko/LuaRemote) on the device that would simply
run a debugger that connects to ZBS running on a desktop. This setup
allowed me to update scripts without re-deploying the app to the device.

Another advantage of using wifi was that I could run the same script from
my desktop without even having the mobile device, but the device allowed to
control the robot autonomously (I had some of them simply running around
sensing walls with an IR sensor when I presented it at a conference).

Since I was running a very simple http server on Arduino, I could also
send/receive commands remotely (in fact, this is how the Lua script talked
to Arduino). Here is the post I put together on streaming real-time data
using AJAX:
http://notebook.kulchenko.com/embedded/streaming-real-time-data-from-arduino-using-ajax-and-persistent-connections

Paul.

Other related posts: