netlabtoolkit / VarSpeedServo

Arduino library for servos that extends the standard servo.h library with the ability to set speed, and wait for position to complete
GNU Lesser General Public License v2.1
292 stars 127 forks source link

isMoving implementation #43

Open jerryg2003 opened 3 years ago

jerryg2003 commented 3 years ago

The documentation implies this exists but it is a "To Do" in the code. I made a simple implementation of this function if you are interested. Added an argument to make it easier. Mimics the code under "write" with wait=true.

bool VarSpeedServo::isMoving(int value) { if (value < MIN_PULSE_WIDTH) { if (read() != value) return(true); } else { if (readMicroseconds() != value) return(true); } return(false); }