Skip to content

Instantly share code, notes, and snippets.

@cbscribe
Created October 30, 2020 19:48
Show Gist options
  • Select an option

  • Save cbscribe/8996c8ea6941e6c3969a4d2bc2d2dfcd to your computer and use it in GitHub Desktop.

Select an option

Save cbscribe/8996c8ea6941e6c3969a4d2bc2d2dfcd to your computer and use it in GitHub Desktop.
void setup()
{
for (int i = 1; i < 9; i++)
{
pinMode(i, OUTPUT);
}
}
void loop()
{
int pot = analogRead(A0);
pot = map(pot, 0, 1023, 0, 8);
for (int i = 1; i < 9; i++)
{
if (i <= pot)
{
digitalWrite(i, HIGH);
}
else
{
digitalWrite(i, LOW);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment