Subject: Re: [ruby-ffi] success using ffi to read Vernier sensor data from ruby and jruby |
From: Jon |
Date: 12/14/09 8:55 AM |
To: ruby-ffi@googlegroups.com |
http://gist.github.com/254981 It's an adaptation of the GoIO_DeviceCheck.cpp sample app supplied with the Vernier GoIO SDK. http://www.vernier.com/downloads/gosdk.html Vernier makes all kinds of inexpensive sensors and interfaces: http://www.vernier.com/go/ [...SNIP..] While the initial implementation is ugly (and doesn't do much) I think it's quite amazing that I can use one dynamic library from Vernier and the same FFI code in Ruby and JRuby! Vernier supplies the full source code for their SDK as public domain. They have dynamic libraries for Mac OS X and Windows (not sure how hard it would be to also compile one for Linux). I don't have a Windows system here but if Nokogiri can work on Windows I'll bet this can also.The initial implementation of a Ruby FFI interface to a Vernier GoIO sensor now works!
That looks really cool and along the same lines I've been itching to start playing with an FFI version of Alan's http://tenderlovemaking.com/2009/09/19/ruby-and-rfid-tags/ Alas, where does the time go :( If you decide to pull your info together into a blog post, would you mind starting a Tutorial's wiki page at http://wiki.github.com/ffi/ffi and put a link to your blog entry, something similar in style to http://wiki.github.com/oneclick/rubyinstaller/tutorials Jon