Created
October 15, 2019 20:23
-
-
Save akshaybaweja/1492a93e2a66c14eeb752fa96530d5a4 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
| #include <Servo.h> | |
| int potPin = 0; | |
| int servoPin = 9; | |
| Servo servo; | |
| void setup() | |
| { | |
| servo.attach(servoPin); | |
| } | |
| void loop() | |
| { | |
| int reading = analogRead(potPin); // 0 to 1023 | |
| int angle = reading / 6; // 0 to 180-ish | |
| servo.write(angle); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment