Advertisement
ptnega

GSF

May 5th, 2015
2,889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Servo.h>
  2.  
  3. ///////////// Servo declaration
  4. Servo myServo;
  5. int posServo = 0;
  6. bool autoServo = 0;
  7. int delayServo = 15;
  8. /////////////
  9.  
  10. ///////////// Motor declaration
  11. bool autoMotor = 0;
  12. /////////////
  13.  
  14. void autoServoOn(){
  15.   autoServo = 1;
  16. }
  17.  
  18. void autoServoOff(){
  19.   autoServo = 0;
  20. }
  21.  
  22. void autoMotorOn(){
  23.   autoMotor = 1;
  24. }
  25.  
  26. void autoMotorOff(){
  27.   autoMotor = 0;
  28. }
  29.  
  30. void ServoSweep(){
  31.  
  32.   if (autoServo == 1){ // Auto Servo Sweep
  33.    
  34.     for ( posServo = 0 ; posServo < 180 ; posServo += 1 ){
  35.         myServo.write(posServo);
  36.         delay(delayServo);
  37.     }
  38.    
  39.     for ( posServo = 180 ; posServo > 0 ; posServo -= 1 ){
  40.         myServo.write(posServo);
  41.         delay(delayServo);
  42.     }
  43.    
  44.   }
  45.   else{ // Manual Servo Sweep
  46.  
  47.   }
  48.  
  49. }
  50.  
  51. void TurnLeft(){
  52.  
  53. }
  54.  
  55. void setup() {
  56.   // put your setup code here, to run once:
  57.   autoServo = 0;
  58.   autoMotor = 0;
  59. }
  60.  
  61. void loop() {
  62.   // put your main code here, to run repeatedly:
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement