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() {
- pinMode(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 == 1) {
- int signal = 1700;
- servo.writeMicroseconds(signal);
- }
- else (buttonS == 0); {
- servo.writeMicroseconds(10);
- }
- Serial.println(buttonS);
- delay(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement