Skip to content

Instantly share code, notes, and snippets.

@SLOLNE
Last active January 27, 2016 18:30
Show Gist options
  • Save SLOLNE/3d856a80f4cb47687422 to your computer and use it in GitHub Desktop.
Save SLOLNE/3d856a80f4cb47687422 to your computer and use it in GitHub Desktop.
//Camille Kauffman
//excercise 5-4 from Getting Started with Arduino
const int LED = 9; // the pin for the LED
int val = 0; // variable used to store the value // coming from the sensor
void setup() {
pinMode(LED, OUTPUT); // LED is as an OUTPUT // Note: Analogue pins are
}
void loop() {
val = analogRead(0); // read the value from // the sensor
analogWrite(LED, val/4); // turn the LED on at // the brightness set
delay(10); // stop the program for // some time
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment