Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*toa spolare, arm 1 (servoA) viker ut och servoB spolar, sen tillbaks till start position */
- #include <Servo.h>
- Servo servoA, servoB;
- int isObstaclePin = 2; // This is our input pin
- int isObstacle = HIGH; // HIGH MEANS NO OBSTACLE
- void setup() {
- servoA.attach(9);
- servoB.attach(10);
- pinMode(isObstaclePin, INPUT);
- Serial.begin(9600);
- }
- void loop() {
- isObstacle = digitalRead(isObstaclePin);
- if (isObstacle == LOW)
- {
- servoA.write(90); //rod1
- delay(1000);
- servoB.write(90); //flush
- delay(2000);
- servoB.write(0); //return flush
- delay(1000);
- servoA.write(0); //return rod to start
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement