Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- int button = 7;
- byte servoPin = 9;
- int buttonS = 0;
- Servo servo;
- void setup() {
- digitalWrite(button, INPUT);
- servo.attach(servoPin);
- servo.writeMicroseconds(1100);
- Serial.begin(9600); // initialize serial communication at 9600 bits per second:
- }
- void loop() {
- buttonS = digitalRead(button);
- if (buttonS = HIGH) {
- int signal = 1700;
- servo.writeMicroseconds(signal);
- }
- else (buttonS = LOW); {
- servo.writeMicroseconds(1100);
- }
- Serial.println(buttonS); // print out the state of the button:
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement