Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define inputPin 2
- #define servoPin 3
- #include <Servo.h>
- Servo servo;
- void setup() {
- pinMode(inputPin, INPUT);
- servo.attach(servoPin);
- }
- void loop() {
- if (digitalRead(inputPin) == HIGH) {
- servo.write(90);
- } else {
- servo.write(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement