Skip to content

Instantly share code, notes, and snippets.

@cbscribe
Last active October 29, 2020 18:47
Show Gist options
  • Save cbscribe/e6adc09fa9196bc5a5faeba5a476389f to your computer and use it in GitHub Desktop.
Save cbscribe/e6adc09fa9196bc5a5faeba5a476389f to your computer and use it in GitHub Desktop.
// 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