Last active
October 29, 2020 18:47
-
-
Save cbscribe/e6adc09fa9196bc5a5faeba5a476389f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Code in the setup section runs once | |
void setup() | |
{ | |
for (int x = 1; x < 5; x++) | |
{ | |
pinMode(x, OUTPUT); | |
} | |
} | |
// Code in the loop section repeats | |
void loop() | |
{ | |
int pot = analogRead(A0); | |
// convert one range to another. | |
pot = map(pot, 0, 1023, 100, 2000); | |
for (int x = 1; x < 5; x++) | |
{ | |
digitalWrite(x, HIGH); | |
delay(pot); | |
digitalWrite(x, LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment