Updated for the next revision of the motor board
MotorShield.h@5:d2dffc88e94d, 2020-08-26 (annotated)
- Committer:
- elijahsj
- Date:
- Wed Aug 26 14:37:16 2020 +0000
- Revision:
- 5:d2dffc88e94d
- Parent:
- 3:2f46953e7c8b
- Child:
- 7:e3a2ade56b79
PWM + Encoders work;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elijahsj | 0:f2ede00aed8a | 1 | /* Library to interface with 2.74 Motor Shield |
elijahsj | 3:2f46953e7c8b | 2 | ** Uses low level HAL libraries to enable high speed PWM |
elijahsj | 5:d2dffc88e94d | 3 | ** Use as follows: |
elijahsj | 5:d2dffc88e94d | 4 | ** - Create shield object and specify PWM period for the motors |
elijahsj | 5:d2dffc88e94d | 5 | ** - Set the duty cycle and direction for each motor |
elijahsj | 0:f2ede00aed8a | 6 | */ |
elijahsj | 0:f2ede00aed8a | 7 | |
elijahsj | 0:f2ede00aed8a | 8 | class MotorShield { |
elijahsj | 0:f2ede00aed8a | 9 | |
elijahsj | 0:f2ede00aed8a | 10 | public: |
elijahsj | 0:f2ede00aed8a | 11 | |
elijahsj | 3:2f46953e7c8b | 12 | MotorShield(int periodTicks); |
elijahsj | 5:d2dffc88e94d | 13 | void motorAWrite(float duty_cycle, int direction); |
elijahsj | 5:d2dffc88e94d | 14 | void motorBWrite(float duty_cycle, int direction); |
elijahsj | 5:d2dffc88e94d | 15 | void motorCWrite(float duty_cycle, int direction); |
elijahsj | 5:d2dffc88e94d | 16 | void motorDWrite(float duty_cycle, int direction); |
elijahsj | 3:2f46953e7c8b | 17 | void changePeriod(int periodTicks); |
elijahsj | 0:f2ede00aed8a | 18 | |
elijahsj | 0:f2ede00aed8a | 19 | private: |
elijahsj | 0:f2ede00aed8a | 20 | |
elijahsj | 3:2f46953e7c8b | 21 | int periodTickVal; |
elijahsj | 3:2f46953e7c8b | 22 | void init(); |
elijahsj | 0:f2ede00aed8a | 23 | |
elijahsj | 0:f2ede00aed8a | 24 | }; |
elijahsj | 0:f2ede00aed8a | 25 |