Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo servoMain;
- Servo servoSecond;// Define our Servo
- Servo servoThird;
- int pos = 0;
- void setup()
- {
- servoMain.attach(12); // servo on digital pin 10
- servoSecond.attach(11);
- servoThird.attach(10);
- Serial.begin(9600);
- Serial.write("+--------------------------------------------------+\n");
- Serial.write("| Type any angle from '0' to '180' degrees into |\n");
- Serial.write("| the serial monitor. |\n");
- Serial.write("| |\n");
- Serial.write("| Bitrate:'9600' |\n");
- Serial.write("| Program:'Servo_Control' |\n");
- Serial.write("| |\n");
- Serial.write("| |\n");
- Serial.write("| |\n");
- Serial.write("| |\n");
- Serial.write("+--------------------------------------------------+\n");
- }
- void loop()
- {
- if(Serial.available() > 0)
- {
- pos = Serial.parseInt();
- }
- servoMain.write(pos);
- servoSecond.write(pos);
- servoThird.write(pos);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement