Ruby NXT Bluetooth Data Logger
I just finished writing a simple ruby script that listens for messages from a LEGO Mindstorms NXT robot on a bluetooth serial port and print out the messages in a comma delimited format with a datestamp, mailbox the message was sent to, and the message itself.
I've only tested it on OSX so far, but it should work on linux and windows so long as you have ruby and the ruby-serialport module. It's a little rough at the moment and probably buggy. I couldn't find info on the incoming message bytecodes in the NXT Dev Kit. Found the info in "Appendix 2 - LEGO MINDSTORMS NXT Direct commands.pdf" pages 5 and 9. There doesn't seem to be anything in the message header to indicate what type of message it is (Text, Number, or Logic), so I had to kind of fudge it. If the info is in the docs, please let me know. I put some comments in the code describing the different bytecodes I was able to figure out.
You can always download the latest version of nxtlogger.rb using this link.
Update 2006-08-05: Made the code much cleaner. I've never worked with low level binary data before. :)
Instructions for connecting NXT to OSX via bluetooth.
One step closer to chunky robotic bacon!
Trackbacks
Use the following link to trackback from your own site:
http://juju.org/articles/trackback/401
Comments
Leave a response, Track co.mments
Juju