... | @@ -217,4 +217,18 @@ make motor A go forwards with 50% dutycycle and motor B go backwards with 20% du |
... | @@ -217,4 +217,18 @@ make motor A go forwards with 50% dutycycle and motor B go backwards with 20% du |
|
<code>
|
|
<code>
|
|
HDU_POWERTRAIN_init(3000);
|
|
HDU_POWERTRAIN_init(3000);
|
|
HDU_POWERTRAIN_setDutycycles(50, -20);
|
|
HDU_POWERTRAIN_setDutycycles(50, -20);
|
|
|
|
</code>
|
|
|
|
|
|
## Servo control (HDU_SERVO.h)
|
|
## Servo control (HDU_SERVO.h)
|
|
|
|
The servo control module allows the control of both servos using TPM1 channel 0 and 1. The ideal PWM signal for a 180° servo should have a frequency of 50 Hz. A dutycytle of 5% means an angle of 0°. The maximum dutycycle is 10% (180°).
|
|
|
|
|
|
|
|
### Module documentation
|
|
|
|
|
|
|
|
####void HDU_SERVO_init(uint32_t frequencyHz)
|
|
|
|
initializes the servos with a specific PWM frequency in Hz.
|
|
|
|
|
|
|
|
#### void HDU_SERVO_X_setDutycycle(float dutycycle)
|
|
|
|
sets PWM dutycycle for servo X with safety check ( 5% - 10% ).
|
|
|
|
|
|
|
|
#### void HDU_SERVO_X_setSteeringAngle(int angle)
|
|
|
|
sets the steering angle of servo X from -90° to 90°. |
|
|
|
\ No newline at end of file |