Wednesday, 28 November 2007

Sync and Run for NintendoDS (this time using Lua)

I like building robots and lately I'm using a NintendoDS as the brain and DSerial2 which is a device that allows me connect servos and stuff to the NintendoDS.

So far so good, but one quickly realizes that the development cycle is quite a pain in the butt:

1) compile
2) take out the MicroSD from the NDS
3) put it in the MicroSD to SD adapter
4) Put the SD adapter in the reader
5) copy the stuff, eject the SD (right click etc..)
6) put the MicroSD in the NintendoDS
7) run the app
8) repeat if you need to tune the app

So after a few iterations things stop being fun.... so here is what I did!

I compiled lua for nintendo with bindings for libwifi, libfat, some stdio from libnds and dserial. This proggy when run loads and executes fat:/autoexec.lua which in my case this script does the following:

1) downloads from my PC a script called robot.lua
2) executes this script
3) when done waits for a keypress
4) goto 1

The trick is that while the NintendoDS waits for a keypress I can edit the the robot.lua on my PC, so yes, I only need to press a key to update the robots.lua and run it

Just for fun I also wrote a web server so you can control dserial using a webbrowser

I'll be posting the tool soon here....

BTW: There is a bug on the DSerial2 interface and it gets locked up when you update the position of the servos quite fast, I hope Natrium42 has a chance to fix this issue soon.