Personal tools
Document Actions

Ruby Command Interface

Up to Idea box

Ruby Command Interface

Posted by Andrew Montgomery at March 18. 2007
I've started messing around with writing a standalone Ruby version the tuxdaemon's usb interface code.

So far I've got a basically working setup using the Ruby-USB library (http://www.a-k-r.org/ruby-usb/).

I had to compile the svn version of ruby-usb on my Xubuntu Edgy install, no idea whether it'll work for anyone else.

I have no idea how safe my code is, so if your tuxdroid blows up don't blame me.

Anyway, though I'd share what I have so far.

To test it, I do the following:

fire up irb:

irb(main):001:0> require 'tuxdroid'
=> true
irb(main):002:0> tux = TuxDroid::Tux.new
=> #evice 001/005 03eb:ff07 C2ME BELGIUM TUX RF DONGLE 10001 (Audio (01,00), Audio (02,00), Audio (02,00), Audio (02,00), Audio (02,00), Unkonwn(00,00,00), Audio (01,00), Audio (02,00), Audio (02,00))>, @tux_handle=#evHandle:0xb78947b8>>
irb(main):022:0> tux.send_command(0x40, 1) # toggles eyes
=> 5
irb(main):023:0> tux.send_command(0x40, 1) # toggles eyes
=> 5
Attachments

Re: Ruby Command Interface

Posted by Andrew Montgomery at March 25. 2007
I've done some more work on this and have now released it as a gem at rubyforge. (http://rubyforge.org/projects/tuxdroid/)

The API is now further developed and is somewhat more usable than the syntax in the above post.

You can now do such things as:

tux.mouth :open

Enjoy
Powered by Ploneboard
You are here: Home Forum Idea box Ruby Command Interface

Powered by Plone CMS, the Open Source Content Management System