Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Car.h
- Revision:
- 8:14e91fdf70e8
- Parent:
- 0:7676da98b5c1
--- a/Car.h Wed Apr 10 02:16:32 2019 +0000 +++ b/Car.h Fri May 24 03:40:06 2019 +0000 @@ -16,12 +16,16 @@ Car( PinName pwm1, PinName fwd1, PinName rev1, + PinName encoderA1, + PinName encoderB1, PinName pwm2, PinName fwd2, - PinName rev2 + PinName rev2, + PinName encoderA2, + PinName encoderB2 ); - //Sets the speed as a percentage (i.e. 1 = 100% and 0.5 = 50%) + //Sets the speed as thicks per second(i.e. 1 = 100% and 0.5 = 50%) void speed(float speed); float speed(void); @@ -40,10 +44,21 @@ float _clamp_speed(float sp); void _mlspeed(float sp); void _mrspeed(float sp); - + float _car_speed; float _car_turn; + + time_t _last_tick_left; + time_t _last_tick_right; + DigitalIn _ml_encoderA; + DigitalIn _ml_encoderB; + DigitalIn _mr_encoderA; + DigitalIn _mr_encoderB; + bool _ml_encoderA_before; + bool _ml_encoderB_before; + bool _mr_encoderA_before; + bool _mr_encoderB_before; PwmOut _ml_pwm; PwmOut _mr_pwm; DigitalOut _ml_fwd;