I was testing out the differences between write() and writeMicroseconds(). I'm using the Parallax Continuous Rotation Servos for simple robot motion. I have been using writeMicroseconds() for years with my students, but a recent switch to MATLAB highlighted the difference since they do not include writeMicroseconds in their Arduino library.
using: leftservo.attach(12, 1400, 1600);
comparing these commands:
A - leftservo.writeMicroseconds(YYYY); // where YYYY = 1400 - 1500 for full speed to stop.
B - leftservo.write(X); // where X = 0 - 90 for full speed to stop
I measured the pulse widths and Option A with the expected results and variable speed within the range. However, in Option B the X value did not vary the linearly between the defined min and max pulse widths. For some reason the min value was 375ms and the max was 2620ms in practice.
Could someone explain why the write() command is not applying the min and max pulse width values? This is true in both Arduino and using MATLAB with Support Package for Arduino Hardware.