Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Atiriya Iyer
- * 6-19-17
- * Servo Motor
- */
- # include <Servo.h>
- Servo miServito;
- const int PotPin= A0;
- int PotVal;
- int angle;
- void setup()
- {
- // put your setup code here, to run once:
- pinMode (PotPin, INPUT);
- miServito.attach (9);
- Serial.begin (9600);
- }
- void loop()
- {
- // put your main code here, to run repeatedly:
- PotVal = (analogRead (PotPin));
- angle= map (PotVal, 0, 1023, 0, 360);
- angle= constrain (angle, 0, 360);
- miServito.write (angle);
- //miServito.write(90);
- //delay(300);
- //miServito.write(180);
- //delay(300);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement