.ruby .normal {} .ruby .comment { color: #888; font-style: italic; } .ruby .keyword { color: #A00; font-weight: bold; } .ruby .method { color: #077; } .ruby .class { color: #074; } .ruby .module { color: #050; } .ruby .punct { color: #447; font-weight: bold; } .ruby .symbol { color: #099; } .ruby .string { color: #944; } .ruby .char { color: #F07; } .ruby .ident { color: #004; } .ruby .constant { color: #07F; } .ruby .regex { color: #B66; } .ruby .number { color: #D55; } .ruby .attribute { color: #377; } .ruby .global { color: #3B7; } .ruby .expr { color: #227; }
# Hardware: motor control circuit (i.e. TIP-120 control pin)
#           connected at pin 7.
#     Demo: http://www.youtube.com/watch?v=7OguEBfdTe0

class SerialMotor < ArduinoSketch
  output_pin 7, :as => :motor
  serial_begin
  
  def loop
    digitalWrite(motor, serial_read) if serial_available
  end
end