Web Interface to Txtzyme
I've put together a small server to relay web requests to a Teensy running Txtzyme. The Sinatra framework brings together assorted technologies to offer secure, reliable, convenient and even friendly remote control.
This simple screen illustrates how more functional programs can be constructed. jQuery manages AJAX requests for both input and output. GET and PUT requests map to Txtzyme i and o commands:
get %r{/([b-f])/([0-7])} do |port, pin| tz "#{pin}#{port}ip" end
put %r{/([b-f])/([0-7])} do |port, pin| tz "#{pin}#{port}#{params(:state)}op" end
Sinatra uses regex patterns (%r strings in Ruby) to recognize and extract parameters (port and pin) from Restful requests. The tz helper puts its argument to the Teensy USB devise and gets a single response which is returned back to the client AJAX callback.
How many frameworks does it take to turn on an LED? A half dozen it appears. Find all of them in the demo project on GitHub
Read more Remote related posts here: