mit
Diff: HBridge.cpp
- Revision:
- 5:e90c8b57811c
- Parent:
- 4:5ae9f8b3a16f
--- a/HBridge.cpp Tue Nov 24 03:56:22 2015 +0000 +++ b/HBridge.cpp Mon Dec 24 03:47:49 2018 +0000 @@ -11,14 +11,34 @@ if (output > 0) { min_1_pin_.write(0); min_2_pin_.write(1); - pwm_pin_.write(output); + pwm_pin_.write(0.5); } else if (output < 0) { min_1_pin_.write(1); min_2_pin_.write(0); - pwm_pin_.write(output * -1); + pwm_pin_.write(0.5); } else { min_1_pin_.write(0); min_2_pin_.write(0); pwm_pin_.write(0.0); } -} \ No newline at end of file +} + +void HBridge::forward() +{ + min_1_pin_.write(1); + min_2_pin_.write(0); + pwm_pin_.write(0.5); +} +void HBridge::back() +{ + min_1_pin_.write(0); + min_2_pin_.write(1); + pwm_pin_.write(0.5); + +} +void HBridge::initialize() +{ + min_1_pin_.write(0); + min_2_pin_.write(0); + pwm_pin_.write(0); +}