Skip to content

Instantly share code, notes, and snippets.

@lostcaggy
Created January 7, 2010 22:49
Show Gist options
  • Save lostcaggy/271683 to your computer and use it in GitHub Desktop.
Save lostcaggy/271683 to your computer and use it in GitHub Desktop.
class Analogled < ArduinoSketch
#Example 04 fade an LED in and out
#from page 59 of Getting started with Arduino
output_pin 9, :as => :led
@i = 1
def loop
while @i < 255 do
analogWrite led, @i
@i +=1
delay 10
end
while @i > 0 do
analogWrite led, @i
@i -=1
delay 10
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment