// ##############################################################
// Stepper Motor Interface #
// ##############################################################
//
// Stepper Motor interface with Raspberry Pi Pico (Hardware & Simulation)
//
// Check out the link for Code explanation and Hardware details
// Link:
// http://tech.arunkumarn.in/blogs/
//
//
#include <Servo.h>
// Create a servo object
Servo myServo;
void setup() {
// Attach the servo on pin 3 to the servo object
myServo.attach(17);
}
void loop() {
// Sweep from 0 to 180 degrees
for (int pos = 0; pos <= 180; pos += 1) {
myServo.write(pos); // Tell servo to go to position in variable 'pos'
delay(15); // Wait 15ms for the servo to reach the position
}
// Sweep back from 180 to 0 degrees
for (int pos = 180; pos >= 0; pos -= 1) {
myServo.write(pos); // Tell servo to go to position in variable 'pos'
delay(15); // Wait 15ms for the servo to reach the position
}
}