Ideally, we implement something like this except in python. (could do some more search for python code).
The servo requires different pulse widths for forward, neutral, reverse, so the interface should provide a set() method that takes (1, 0, -1) and then produces the appropriate pulse width using the PWM object.
You'll need to read a little about PWM and ask questions. We'll have a servo and robot for you to play with this.
/**
* This is a driver for a continuous rotation servo with neutral at 1500us pulse
* width.
*/
public class ContinuousRotationServo extends PWM {
public ContinuousRotationServo(int channel) {
super(channel);
setBounds(1.0, 1.48, 1.5, 1.52, 2.0);
enableDeadbandElimination(true);
}
@Override
public void setBounds(double min, double dead_min, double center, double dead_max, double max) {
super.setBounds(min, dead_min, center, dead_max, max);
}
public void set(double value) {
setSpeed(value);
}
}
Ideally, we implement something like this except in python. (could do some more search for python code).
The servo requires different pulse widths for forward, neutral, reverse, so the interface should provide a set() method that takes (1, 0, -1) and then produces the appropriate pulse width using the PWM object.
You'll need to read a little about PWM and ask questions. We'll have a servo and robot for you to play with this.