Last active
January 27, 2016 18:30
-
-
Save SLOLNE/3d856a80f4cb47687422 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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