More Ruby Syntax Fun

July 9, 2008

With the addition of Brian’s revised lcd and servo libraries, we’ve been working to ensure consistent syntax across the sketch.  The original screencast featured the following method calls:

 1 class Quattro < ArduinoSketch
 2
 3   input_pin 3, :as => :sensor
 4   output_pin 13, :as => :led
 5
 6
 7   def loop
 8     reading = add_hysteresis sensor, 8
 9     blink led, 100 if reading > 100
10     blink led, 1000 if reading <= 100
11   end
12
13 end

However, isn’t dot notation more intuitive:

 1 class Quattro < ArduinoSketch
 2
 3   input_pin 3, :as => :sensor
 4   output_pin 13, :as => :led
 5
 6
 7   def loop
 8     reading = add_hysteresis sensor, 8
 9     led.blink 100 if reading > 100
10     led.blink 1000 if reading <= 100
11   end
12
13 end

Today both work.

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 =>  :o ff
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.

Best Toy Ever Turns 50

January 28, 2008

The LEGO brick turns 50 at exactly 1:58 p.m. today, January 28, 2008, which explains the Google graphic:

Google Lego Tribute

Via byTheBoxes

No Fraud Detection System

January 28, 2008

Ok, Jérôme Kerviel confesses to $70 million in “unauthorized trades” in an effort to become a “star trader”.  Quelle ambition.  Société Générale’s fraud detection system isn’t.

Lucioano Podcaminsky

January 24, 2008

On a light hearted note.  Besides creating “Surgery” for Nike Women online, Luciano Podcaminsky demonstrates a light Pythonesque “Got Milk?” ad:

via shape + colour

“Should I run behind a bus and breathe in the exhaust? Should I train on the highway during rush hour? Is there any way to acclimate myself to pollution?” Nice lead to a tough subject, Beijing Air Quality.  by The Boxes also points to BeijingAirblog

Ethanol from Corn

January 12, 2008

Ethanol from Corn

Making ethanol from corn is expensive, using 77% of its stored energy just to produce. Cellulosic ethanol which requires significantly less power to produce is ethanol produced from cellulose instead of corn starch. More corn worries: The enormous volume of corn required by the ethanol industry is sending shock waves through the food system.

Ice Caps

January 10, 2008