Arduino sketches and lab materials for MEC108 Lab 1. The examples focus on basic stepper motor control with the AccelStepper library, including single direction movement, limit switch sensing, and controlled return motion.
MEC108 Lab 1 Manual.pdf- lab handout and reference material.Stepper_Example/- starter sketch for stepper configuration and serial output.left/- moves the stepper motor left for a fixed number of steps.right/- moves the stepper motor right for a fixed number of steps.M5/- moves right until a limit switch is triggered, pauses, then moves left for a timed interval.M5v1/- moves right until a limit switch is triggered, pauses, then moves left for a fixed step count.
- Stepper pulse pin: digital pin
2 - Stepper direction pin: digital pin
5 - Limit switch pin: digital pin
9withINPUT_PULLUP - Arduino library:
AccelStepper
- Install the
AccelStepperlibrary in the Arduino IDE. - Open the desired
.inosketch folder in the Arduino IDE. - Connect the stepper driver and limit switch according to the pin notes above.
- Upload the sketch to the Arduino board.
- Open Serial Monitor at
9600baud to view status messages where available.