Updated for the next revision of the motor board
MotorShield.h
- Committer:
- elijahsj
- Date:
- 2020-08-25
- Revision:
- 1:4c3c2b7337a6
- Parent:
- 0:f2ede00aed8a
- Child:
- 3:2f46953e7c8b
File content as of revision 1:4c3c2b7337a6:
/* Library to interface with 2.74 Motor Shield ** Uses a modified version of FastPWM library to improve PWM accuracy */ class MotorShield { public: /** Receives two PinName variables. * @param echoPin mbed pin to which the echo signal is connected to * @param triggerPin mbed pin to which the trigger signal is connected to */ MotorShield(PinName forwardPin, PinName reversePin); /** Calculates the distance in cm, with the calculation time of 25 ms. * @returns distance of the measuring object in cm. */ void write(double duty_cycle); void period(double period); void direction(int direction); private: int direction_val; double duty_cycle_val; double period_val; void init(); void writePWM(); };