Created
October 30, 2020 19:48
-
-
Save cbscribe/8996c8ea6941e6c3969a4d2bc2d2dfcd 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
| 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