Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- int pinServo = 11;
- int pinSwitch = 10;
- boolean a180=true;
- Servo myservo1;
- Servo myservo2;
- void setup()
- {
- myservo1.attach(11);
- pinMode(pinSwitch,INPUT);
- }
- void loop()
- {
- if (a180 == true){
- myservo1.write(180);
- delay(2000);
- }else{
- myservo1.write(0);
- delay(2000);
- }
- if (digitalRead(pinSwitch) == HIGH){
- if (a180 == true){
- a180 = false;
- }else{
- a180=true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment