The Illuminato X Machina platform can scale processes to multiple modular segments on the fly. These units are local hardware, not slow remote servers, so IO is cheap. With a library for communication to the host machine, the community can start building powerful libraries.
Those on the Illuminato X Machina mailing list are familiar with the packet interface David Ackley has already written in C++. A partner in that system is the sfbprog binary. sfbprog is meant to auto-program IXMs with new sketches, but through a simple hack can create a packet-based terminal to the Illuminato X Machina hardware:
old_sketch.hex needs to have an older timestamp than the code currently running on your IXMs. Flavor the device and .hex file to taste, and you've got a real-time packet interface to the Illuminato X Machina hardware.sfbprog -n /dev/ttyUSB0 -S - -t 0 -f /tmp/old_sketch.hex
LibIXM and Ruby
The sfbprog terminal is a simple solution, but not something you want to build on top of. Building a Ruby library gives the Illuminato X Machina's community a toe-hold on the desktop machines connected to IXM hardware. LibIXM for Ruby has two levels of abstraction:
- Adapters: hardware compatibility layers.
- Interfaces: software behavior models.
The basic interface supported by this first release is Simple. This interface is based off a callback pattern, similar to the Body.reflex already available in the IXM core API.
So Happy Together
Enough talk, let's see some code. This sketch is a basic packet-level echo for the Illuminato X Machina hardware:
And this is a Ruby LibIXM "yodler" built off the sketch:void yowl(u8 * packet) {
facePrintf(packetSource(packet), "You sent me a '%#p'\n", packet);
}
void setup() {
Body.otherwise(yowl);
}
void loop() {}
With the default Simple interface you get the method of attach_reflex. Richer interfaces should follow in the future!require File.join( File.dirname(__FILE__), '..', 'libixm' )
ixm = LibIXM.new()
# Build a reflex for our packet
responded = false
ixm.attach_reflex( /yodel/ ) do |packet|
puts "IXM yodeled: #{packet}"
responded = true
end
# Send a packet.
ixm << "yodel yo momma ha"
# Wait for the response.
loop { break if responded }
LibIXM should be available as a gem from Github, but Github is having yet another epic FAIL this week. You can install it as a gem:
Or pull the source via git at http://github.com/mixonic/libixm. This takes "throwing hardware at a problem" to a whole new level! Go grab yourself an Illuminato X Machina and IXM Red Terminal Programmer and start pushing some work off your desktop's processor.wget http://www.liquidware.com/system/0000/2752/libixm-0.1.0.gem
sudo gem install ./libixm-0.1.0.gem
** Update **
Github just caught up and built the gem, so now you can install with:
gem sources -a http://gems.github.com
sudo gem install mixonic-libixm
2 comments:
wait are you kidding? nice goin!
do a lot of people use ruby? i wish i knew what lots of coders use... i use perl, for instance, but that kinda fell out of favor in the 1990's i think...
Post a Comment