While working with completely virtualized systems and architectures is fun, for me it’s never been quite as much fun as doing things in the Real World™. A few years ago I found Phidgets Inc. Phidgets are a set of “plug and play” building blocks for low cost USB sensing and control from your PC. From their website:
All the USB complexity is taken care of by our robust API. Applications can be developed quickly by programmers using their favorite language: C/C++, C#, Cocoa, Delphi, Flash AS3, Flex AS3, Java, LabVIEW, MATLAB, Max/MSP, MRS, Python, REALBasic, Visual Basic.NET, Visual Basic 6.0, Visual Basic for Applications, Visual Basic Script, and Visual C/C++/Borland.NET.
Unfortunately, there is one language that is absent from this list: Ruby.
Several years ago, there was an effort started by Craig DeHaan and later picked up by Kit Plummer which worked pretty well but the callbacks seemed a little fragile and I wanted the interface to be a little more idiomatically Ruby. Also, using FFI means it works on multiple Ruby VMs without issue, MRI, JRuby, etc. Like the previous libraries, there aren’t many devices supported yet but that’s just a matter of having them. There are traditional and idiomatic examples in the repository and it can be installed with everybody’s favorite command: gem install phidgets-ffi.
The source and additional documentation can be found at https://github.com/kreynolds/phidgets-ffi. Enjoy