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: L298HBridge.cpp
- Revision:
- 1:0af00b1a2b52
- Parent:
- 0:85a98c7707c9
--- a/L298HBridge.cpp Tue Feb 14 09:48:32 2017 +0000
+++ b/L298HBridge.cpp Tue Feb 14 12:41:49 2017 +0000
@@ -1,17 +1,35 @@
#include "L298HBridge.h"
#include "mbed.h"
-L298HBridge::L298HBridge(PinName ENpin, PinName FWDpin, PinName REVpin) : _en(ENpin), _fwd(FWDpin), _rev(REVpin) {
+L298HBridge::L298HBridge(PinName ENpin, PinName FWDpin, PinName REVpin) : _en(ENpin), _fwd(FWDpin), _rev(REVpin)
+{
_fwd = 0;
_rev = 0;
_en = 0.0;
}
-void L298HBridge::Fwd() {
-
+void L298HBridge::Fwd()
+{
+ _fwd = 1;
+ _rev = 0;
+}
+
+void L298HBridge::Rev()
+{
+ _fwd = 0;
+ _rev = 1;
}
+
+void L298HBridge::Stop()
+{
+ _fwd = 1;
+ _rev = 1;
+}
+
+
-void L298HBridge::Speed(float PWMPercentage) {
-
+void L298HBridge::SetSpeed(float PWMPercentage)
+{
+ _en = PWMPercentage;
}
\ No newline at end of file