Sha256: ae1da5cedf26b1e00cecaf17573031cc97d0a58300e55c5fcefb7e30c73354c7
Contents?: true
Size: 637 Bytes
Versions: 2
Compression:
Stored size: 637 Bytes
Contents
require 'artoo' # Circuit and schematic here: http://arduino.cc/en/Tutorial/Fade connection :firmata, :adaptor => :firmata, :port => '/dev/ttyACM0' # linux #connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023' device :board, :driver => :device_info device :led, :driver => :led, :pin => 3 brightness = 0 fade_amount = 5 work do puts "Firmware name: #{board.firmware_name}" puts "Firmata version: #{board.version}" led.on every(0.05) do led.brightness(brightness) brightness = brightness + fade_amount if brightness == 0 or brightness == 255 fade_amount = -fade_amount end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
artoo-arduino-1.4.4 | examples/led_brightness.rb |
artoo-arduino-1.4.3 | examples/led_brightness.rb |