Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo myservo1;
- Servo myservo2;
- Servo myservo3;
- Servo myservo4;
- int pos1 = 90, pos2 = 90, pos3 = 100, pos4 = 0;
- void setup() {
- checkSW();
- myservo1.attach(A1);
- myservo2.attach(A0);
- myservo3.attach(6);
- myservo4.attach(9);
- myservo1.write(pos1);
- myservo2.write(pos2);
- myservo3.write(pos3);
- myservo4.write(pos4);
- delay(3000);
- }
- void loop() {
- for(pos4;pos4<100;pos4++)
- {
- myservo4.write(pos4);
- delay(5);
- }
- delay(3000);
- for(pos3;pos3>30;pos3--)
- {
- myservo3.write(pos3);
- delay(5);
- }
- delay(3000);
- for(pos4;pos4>0;pos4--)
- {
- myservo4.write(pos4);
- delay(5);
- }
- delay(3000);
- for(pos3;pos3<100;pos3++)
- {
- myservo3.write(pos3);
- delay(5);
- }
- delay(3000);
- for(pos2;pos2>30;pos2--)
- {
- myservo2.write(pos2);
- delay(5);
- }
- delay(3000);
- for(pos2;pos2<90;pos2++)
- {
- myservo2.write(pos2);
- delay(5);
- }
- delay(3000);
- for(pos3;pos3>30;pos3--)
- {
- myservo3.write(pos3);
- delay(5);
- }
- delay(3000);
- for(pos4;pos4<100;pos4++)
- {
- myservo4.write(pos4);
- delay(5);
- }
- delay(3000);
- for(pos3;pos3<100;pos3++)
- {
- myservo3.write(pos3);
- delay(5);
- }
- delay(3000);
- for(pos4;pos4>0;pos4--)
- {
- myservo4.write(pos4);
- delay(5);
- }
- delay(3000);
- }
- void checkSW()
- {
- pinMode(7, INPUT);
- while(!digitalRead(7)){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement