// sketch.ino
// Main test loop for the stepper motor module
#include "stepper_motor.h"
const int buttonPin = 2;
void setup() {
pinMode(buttonPin, INPUT_PULLUP); // Set button as Active-LOW
setupStepper(); // Initialize motor pins
delay(100); // Stabilize power to prevent false triggers
}
void loop() {
// Trigger cycle on button press
if (digitalRead(buttonPin) == LOW) {
moveStepperToBin(); // Move arm to the sorting bin
delay(2000); // Simulate the scrap drop time
moveStepperToHome(); // Return arm to the start position
// Wait for button release (debounce)
while(digitalRead(buttonPin) == LOW);
}
}