Advertisement
Push28

serial controlled mono servo

Nov 12th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. // Code for serial servo attachment
  2. #include <Servo.h>
  3. Servo servo1;
  4. long num1;
  5.  
  6. void setup(){
  7. servo1.attach(3);
  8. Serial.begin(9600);
  9. servo1.write(90);
  10. }
  11.  
  12. void loop() {
  13. while(Serial.available()>0)
  14. {
  15. num1= Serial.parseInt();
  16. Serial.print(num1);
  17. Serial.print(" degree , ");
  18. Serial.print("Enter Position = ");
  19. }
  20. servo1.write(num1);
  21. delay(15);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement