Advertisement
Orion5001

Stepper Pseudocode

Oct 19th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. Include NewLiquidCrystal library
  2. Include AccelStepper library
  3. Define pins
  4. Display welcome message on LCD for 3 seconds
  5. Set min and max speeds allowed and correspond them to potentiometer min and max positions
  6. While true
  7. If rocker switch is on
  8. If current speed = 0
  9. Accelerate to speed defined by potentiometer position
  10. If current speed > 0
  11. Set speed equal to potentiometer position
  12. Calculate RPM based of potentiometer position
  13. Show "Motor is operating at ___ RPMs" on display
  14. If rocker switch is off
  15. Show “motor is off” message on display
  16. If speed > 0
  17. Decelerate to speed of 0
  18. Else If speed = 0
  19. Do nothing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement