Skip to content

Use interrupts and timers to generate stepper pulses

Currently the steppers are driven by a function which does

do until reached position and have not hit limit swithc:
* stepper pin HIGH
* sleep 25 us
* stepper pin LOW
* sleep (variable ammount >> 25 us)
repeat

Making the stepper-functions timer based instead of software sleep would enable:

  • Simultaneous X-Y movement
  • Network I/O during movement (network in main loop, movement with interrupts)
    • -> Possible to have a soft STOP command (that should also clear the command queue)
    • Output of what is current position during movement

Info on Arduino timers and interrupts:

This was mentioned in !9 (merged) but not implemented here; if implemented it should be in a new branch.