Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://imgur.com/a/IoYvF4z
- #include <Servo.h>
- Servo servoBase; // Create a Servo object and assign it a specific name
- void setup()
- {
- servoBase.attach(A1); // Specify the pin to use for the servo
- servoBase.write(0); // Set the servo motor to the 0-degree position
- }
- void loop()
- {
- // Sweep the servo from 0 to 180 degrees in steps of 10 degrees
- for (int i = 0; i <= 180; i += 10)
- {
- servoBase.write(i); // Set the servo to the current angle
- delay(2000); // Pause for 2000 milliseconds (2 seconds)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement