Last active
September 28, 2021 18:36
-
-
Save camateg/8c1f26fe007a192b01d1d3e6e447b85f 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
| #define LEDPWM 3 | |
| #define POT A1 | |
| void setup() { | |
| pinMode(LEDPWM, OUTPUT); | |
| pinMode(POT, INPUT); | |
| Serial.begin(9600); | |
| } | |
| void loop() { | |
| int val; | |
| val = analogRead(POT); | |
| Serial.print(int((val / 904.0) * 100)); | |
| Serial.println("%"); | |
| analogWrite(LEDPWM, val / 4); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment