Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo MyServito;
- const int PotPin = A0;
- const int ServoPin= 9;
- int PotVal= 0;
- int angle = 0;
- void setup() {
- pinMode(PotPin, INPUT);
- MyServito.attach(ServoPin);
- Serial.begin(9600);
- }
- void loop() {
- PotVal = analogRead(PotPin);
- angle = map(PotVal, 0, 1023, 0, 179);
- angle = constrain(angle, 0, 179);
- MyServito.write(angle); //figures out how to write to the Servito-- dont need to specify what pin # is
- delay(15);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement