How do we make input and output pin declarations simple and straightforward?  The first pass used options to trigger pin behavior.  In the following example, setting a min and max sets up a servo, and the latch option sets up a button:

1 class InOutDemo < ArduinoSketch
2
3   input_pin 6, :as => :button_one, :latch => :off
4   output_pin 7, :as => :my_servo, :min => 700, :max => 2200
5

After working through this, the notion of a device option seems like a better choice:

1 class InOutDemo < ArduinoSketch
2
3   input_pin 6, :as => :button_one, :device => :button
4   output_pin 7, :as => :my_servo, :device => :servo
5   output_pin 8, :as => :my_lcd, :device => :sf_lcd
6

Declaring a device will setup default settings for that device. For example, the servo will default to a min and max of 544 and 2400. For LCD screens, the default serial rate and driver is setup.

Ruby on Bells

July 1, 2008

Madrona Fork is not located near Yosemite, but is an experimental fork of the fab Ruby Arduino Development gem.  I liked it so much I added a basic plugin structure and extended the sketch capabilities, as well as a few other goodies such as pin options for buttons and servos.  This video shows the forked code running three servos playing “song methods”.  Ruby and Arduino are simply a brilliant combination.