Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Amber Syed
- #include <Servo.h>
- Servo miServito;
- const int PotPin=A0;
- int PotVal;
- int angle;
- void setup()
- {
- pinMode (PotPin, INPUT);
- miServito.attach (9);
- Serial.begin (9600);
- }
- void loop()
- {
- PotVal=analogRead (PotPin);
- angle= map (PotVal, 0, 1023, 0, 179);
- angle = constrain (angle, 0, 179);
- miServito.write(angle);
- miServito.write (0);
- delay (500);
- miServito.write (45);
- delay (500);
- miServito.write (90);
- delay (500);
- miServito.write (135);
- delay (500);
- miServito.write (180);
- delay (500);
- }
Advertisement
Add Comment
Please, Sign In to add comment