Reference Language | Libraries | Comparison | Changes
Virtual objects embed a PID controller: pid1 acts on M1 and encoder1, pid2 on M2 and encoder2. It is advisable to control the motors using these functions.
pid1.setGains(int P, int I, int D)
setGains(int P, int I, int D)
: Set PID gains
resetGains()
: Reset PID gains to factory
setControlMode(cl_control)
: Set control mode (CL_VELOCITY
or CL_POSITION
)
setSetpoint(cl_mode, int target)
: Set the actual setpoint in TARGET_VELOCITY
or TARGET_POSITION
setMaxAcceleration(int)
: Sets maximum acceleration
setMaxVelocity(int)
: Sets maximum velocity
setLimits(int min, int max)
: Sets duty cycle limits (for example, to limit the maximum speed of the motor)
Corrections, suggestions, and new documentation should be posted to the Forum.
The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.