Sha256: 21706e232600d17f8e0872ed193084c76a69d5360bb13464bce430c27c592001

Contents?: true

Size: 626 Bytes

Versions: 5

Compression:

Stored size: 626 Bytes

Contents

require 'artoo'

# Circuit and schematic here: http://arduino.cc/en/Tutorial/Fade

#connection :firmata, :adaptor => :firmata, :port => '/dev/tty*'
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

5 entries across 5 versions & 1 rubygems

Version Path
artoo-arduino-1.4.2 examples/led_brightness.rb
artoo-arduino-1.4.1 examples/led_brightness.rb
artoo-arduino-1.4.0 examples/led_brightness.rb
artoo-arduino-1.3.0 examples/led_brightness.rb
artoo-arduino-1.2.0 examples/led_brightness.rb