Last active
January 28, 2018 18:57
-
-
Save garethfoote/9ff116aec48e25a215f81fac3bbc24ac 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
// Make variables to be used throughout code | |
int sensorPin = A0; | |
int ledPin = 13; | |
void setup() { | |
// Tell pin 13 to work as an output: | |
pinMode(ledPin, OUTPUT); | |
} | |
void loop() { | |
// Read the value from the sensor: | |
int sensorValue = analogRead(sensorPin); | |
// Turn the ledPin on | |
digitalWrite(ledPin, HIGH); | |
// Stop the program for <sensorValue> milliseconds: | |
delay(sensorValue); | |
// Turn the ledPin off | |
digitalWrite(ledPin, LOW); | |
// Stop the program for for <sensorValue> milliseconds: | |
delay(sensorValue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment