<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Juju: Ruby NXT Bluetooth Data Logger</title>
    <link>http://juju.org/articles/2006/08/03/ruby-nxt-bluetooth-data-logger</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Sufficiently Advanced Technology</description>
    <item>
      <title>Ruby NXT Bluetooth Data Logger</title>
      <description>&lt;p&gt;I just finished writing a simple ruby script that listens for messages from a &lt;a href="http://www.mindstorms.com"&gt;LEGO Mindstorms NXT&lt;/a&gt; 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.&lt;/p&gt;

&lt;p&gt;I've only tested it on OSX so far, but it &lt;em&gt;should&lt;/em&gt; work on linux and windows so long as you have &lt;a href="http://ruby-lang.org"&gt;ruby&lt;/a&gt; and the &lt;a href="http://raa.ruby-lang.org/project/ruby-serialport/"&gt;ruby-serialport&lt;/a&gt; module.  It's a little rough at the moment and probably buggy.  &lt;strike&gt;I couldn't find info on the incoming message bytecodes in the NXT Dev Kit.&lt;/strike&gt; 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.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://svn.juju.org/svn/public/nxtlogger/nxtlogger.rb"&gt;You can always download the latest version of nxtlogger.rb using this link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 2006-08-05:&lt;/strong&gt; Made the code much cleaner.  I've never worked with low level binary data before.  :)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://juju.org/articles/2006/08/01/mindstorms-nxt-bluetooth-on-osx"&gt;Instructions for connecting NXT to OSX via bluetooth&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One step closer to chunky robotic &lt;a href="http://en.wikipedia.org/wiki/Chunky_bacon"&gt;bacon&lt;/a&gt;!&lt;/p&gt;</description>
      <pubDate>Thu, 03 Aug 2006 01:08:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:a4042fd0-0d86-409a-b75a-5f5de0b9ac44</guid>
      <author>Tony Buser</author>
      <link>http://juju.org/articles/2006/08/03/ruby-nxt-bluetooth-data-logger</link>
      <category>Mindstorms</category>
      <category>Code</category>
      <category>Robots</category>
      <category>Ruby</category>
      <category>mindstorms</category>
      <category>nxt</category>
      <category>ruby</category>
      <category>bluetooth</category>
      <trackback:ping>http://juju.org/articles/trackback/401</trackback:ping>
    </item>
  </channel>
</rss>
