// Raspberry Pi Pico + Stepper Motor Example
#define DIR_PIN 2
#define STEP_PIN 3
void setup() {
pinMode(15, OUTPUT);
pinMode(14, OUTPUT);
pinMode(13, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
digitalWrite(STEP_PIN, LOW);
}
void loop() {
digitalWrite(DIR_PIN, HIGH);
for (int i = 0; i < 25; i++) {
digitalWrite(STEP_PIN, HIGH);
digitalWrite(STEP_PIN, LOW);
if(DIR_PIN<=200){
digitalWrite(15, HIGH);
}
else if(DIR_PIN>200){
digitalWrite(14, HIGH);
}
else {
digitalWrite(13, HIGH);
}
delay(100); // 5 ms * 200 = 1 second
}
}
}