Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- ///////////// Servo declaration
- Servo myServo;
- int posServo = 0;
- bool autoServo = 0;
- int delayServo = 15;
- /////////////
- ///////////// Motor declaration
- bool autoMotor = 0;
- /////////////
- void autoServoOn(){
- autoServo = 1;
- }
- void autoServoOff(){
- autoServo = 0;
- }
- void autoMotorOn(){
- autoMotor = 1;
- }
- void autoMotorOff(){
- autoMotor = 0;
- }
- void ServoSweep(){
- if (autoServo == 1){ // Auto Servo Sweep
- for ( posServo = 0 ; posServo < 180 ; posServo += 1 ){
- myServo.write(posServo);
- delay(delayServo);
- }
- for ( posServo = 180 ; posServo > 0 ; posServo -= 1 ){
- myServo.write(posServo);
- delay(delayServo);
- }
- }
- else{ // Manual Servo Sweep
- }
- }
- void TurnLeft(){
- }
- void setup() {
- // put your setup code here, to run once:
- autoServo = 0;
- autoMotor = 0;
- }
- void loop() {
- // put your main code here, to run repeatedly:
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement