Sha256: fa3b1925e096d78f00e26707bea43db425ad801ed638a311cba2760d16ba0cfb

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

require_relative '../lib/frankenpins'

# Create a new LED attached to Wiring Pi pin #6.
led = Frankenpins::LED.new(:pin => 6)

# Simple LED examples

puts "Turning LED on"
led.on

# Do nothing for 2 seconds
sleep(2)

puts "Turning LED off"
led.off

sleep(2)

# Variable brightness using PWM

puts "Turning to the LED to 20% brightness"
led.brightness(20)
led.on
sleep(2)

puts "Turning to the LED to 40% brightness"
led.brightness(40)
sleep(2)

puts "Turning to the LED to 60% brightness"
led.brightness(60)
sleep(2)

puts "Turning to the LED to 80% brightness"
led.brightness(80)

sleep(2)

puts "Turn LED off"
led.off

Frankenpins.wait

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frankenpins-0.3.0 examples/led.rb