Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo myservo; // create servo object to control a servo
- // twelve servo objects can be created on most boards
- int pos = 0; // variable to store the servo position
- void setup() {
- myservo.attach(9); // attaches the servo on pin 9 to the servo object
- Serial.begin(9600);
- }
- int i = 0;
- void loop() {
- if(Serial.available()) {
- i = Serial.parseInt();
- }
- Serial.println(i);
- myservo.writeMicroseconds(i);
- delay(50);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement