Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo myservo;
- int runLevel = 0;
- int servoPin = 5;
- int pwmInPin = 4;
- int ledPin = 13;
- void setup() {
- pinMode(ledPin, OUTPUT);
- pinMode(pwmInPin, INPUT);
- }
- void loop() {
- if (runLevel == 0)
- {
- delay(5000);
- myservo.attach(servoPin);
- runLevel = 1;
- }
- if (runLevel == 1)
- {
- myservo.writeMicroseconds(500);
- delay(2000);
- digitalWrite(ledPin, HIGH);
- runLevel = 2;
- myservo.detach();
- }
- if (runLevel == 2)
- {
- digitalWrite(servoPin,digitalRead(pwmInPin));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement