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