Skip to content

Instantly share code, notes, and snippets.

@lostcaggy
Created January 7, 2010 23:51
Show Gist options
  • Save lostcaggy/271729 to your computer and use it in GitHub Desktop.
Save lostcaggy/271729 to your computer and use it in GitHub Desktop.
class Analoginput06b < ArduinoSketch
#Example 06B Set the brightness of the LED to a brighness specified by the value
#of the analgue input
#page 67 Getting started with arduino
output_pin 9, :as => :led #pin for led
@val = 0
def loop
@val = analogRead(0)
analogWrite (led, @val/4)
delay 10
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment