Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Include NewLiquidCrystal library
- Include AccelStepper library
- Define pins
- Display welcome message on LCD for 3 seconds
- Set min and max speeds allowed and correspond them to potentiometer min and max positions
- While true
- If rocker switch is on
- If current speed = 0
- Accelerate to speed defined by potentiometer position
- If current speed > 0
- Set speed equal to potentiometer position
- Calculate RPM based of potentiometer position
- Show "Motor is operating at ___ RPMs" on display
- If rocker switch is off
- Show “motor is off” message on display
- If speed > 0
- Decelerate to speed of 0
- Else If speed = 0
- Do nothing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement