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