Advertisement
jfsimon1981

Untitled

Jun 29th, 2025
398
0
13 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. // Feeder Stepper Control
  2. #include <Stepper.h>
  3. #define STEPS_PER_TURn 200 // Steps per turn
  4. Stepper stepper(STEPS_PER_TURn, 8, 9, 10, 11); // Wiring
  5.  
  6. // the previous reading from the analog input
  7. const int position_min = 0; // Origin
  8. const int position_max = 2000; // Steps for Feeder Full Sweep
  9.  
  10. void setup() {
  11.   stepper.setSpeed(30); // Stepper speed, RPM
  12. }
  13.  
  14. void loop() {
  15.   // move a number of steps equal to the change in the
  16.   // sensor reading
  17.   stepper.step(position_max - position_min);
  18.   stepper.step(position_min - position_max);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement