Set a division rate of micro step by using setMode() function.
step.setMode(mode)
mode - the division rate of micro step
mode | description |
---|---|
1 | Full-step |
2 | Half-step |
4 | 1/4-step |
8 | 1/8-step |
16 | 1/16-step |
32 | 1/32-step |
Before starting the stepper motor, it is necessary to set the limit current to maintain each state for the following three states.
state | function for current limiting |
---|---|
stop | step.setVrefStop(vref) |
drive | step.setVrefDrive(vref) |
lock | step.setVrefLock(vref) |
vref - The amount of limiting current (0 ~ 15)
※ Note : There are 16 levels for limiting current from 0 to 15. If you set the vref to 5, the current is limited to 5 of 15.
You can set a resonance range by using setResonance() function.
step.setResonance(low, high)
high - the highest value of the range in pps unit
The unit of both values are pps(pulse per second). Once the resonance range is set, the board drives a motor with the speed which is set by highest value of the range if the rotation speed falls within the resonance range.
You can set a rotation speed by using setSpeed() function.
step.setSpeed(speed)
speed - the rotation speed in pps unit
The unit of this value is pps(pulse per second) and the board provides 240,000[pps] as its maximum speed. However, the actual maximum speed depends on the type, voltage and loads of the stepper motor.
You can set both acceleration and deceleration by using setAccel() function.
step.setAccel(accel)
step.setAccel(accel, decel)
decel - deceleration in pps/s unit
The unit of both is pps/s(pps per second) and the board provides 2,400,000[pps/s] as its maximum value. If the deceleration is omitted, it is automatically set to the same value of the acceleration.
You can set a counter position by using setPosition() function.
step.setPosition(pos)
pos - the counter position
This value is a signed 32-bit integer and can have a value between -1000000000(1 billion) and +1000000000. This setting is valid only when controlling stepper motor with stepGoto() and is not reflected when controlling with stepMove().
You can set digital input ports by using setEioMode() function.
step.setEioMode(id, mode)
mode - the type of the digital input port
mode | description |
---|---|
0 | normal input |
otherwise | control lock |