monceypants274

IDK

Jan 27th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <Servo.h>
  2.  
  3. Servo myservo;            
  4.  
  5. int servoPin = 13;          
  6. int potPin = 3;            
  7. int potVal;                
  8.  
  9. void setup() {
  10.   myservo.attach(servoPin);
  11. }
  12.  
  13. void loop() {
  14.   potVal = analogRead(potPin);        
  15.   potVal = map(potVal, 0, 1023, 0, 180);
  16.   myservo.write(potVal);                
  17.   delay(15);                            
  18. }
Advertisement
Add Comment
Please, Sign In to add comment