Stap 8: Arduino Code
#include
Const int buttonPin = 2;
Const int buttonPin2 = 8;
int buttonState = 0;
int buttonState2 = 0;
Servo servoA;
int positie = 0;
VOID Setup {}
servoA.attach(9);
pinMode (buttonPin, INPUT);
pinMode(buttonPin2,INPUT);
}
void loop {}
buttonState = digitalRead(buttonPin);
buttonState2 = digitalRead(buttonPin2);
Als (buttonState == HIGH & & positie < 90) {}
servoA.write(position++);
delay(5);
}
Als (buttonState2 == HIGH & & positie van > 3) {}
servoA.write(position--);
delay(5);
} }