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.
Dependencies: GPS2 L3GD20 LSM303DLHC2 PID mbed SDFileSystem
Fork of GPSNavigation by
Diff: TrollingMotor.h
- Revision:
- 8:c77ab7615b21
- Child:
- 12:273479524c71
diff -r ebc76b0f21da -r c77ab7615b21 TrollingMotor.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TrollingMotor.h Mon Apr 27 16:49:48 2015 +0000
@@ -0,0 +1,59 @@
+/*************************************************************************************************************************************************************/
+// Created by: Ryan Spillman
+//
+// Last updated 4/9/2015
+//
+// Contains functions for controlling trolling motor relays
+/*************************************************************************************************************************************************************/
+DigitalOut direction(D5);
+DigitalOut enable(D4);
+
+/*************************************************************************************************************************************************************/
+// Relay Trolling Motor Control
+/*************************************************************************************************************************************************************/
+
+int prevState = 0;
+
+void goForward()
+{
+
+ //Are we changing states?
+ if(prevState == 2)
+ {
+ //Short to ground will occur if parallel H-Bridge Relays are not synchronous when changing states
+ //turn off Run/Stop relay first to prevent short
+ enable = 0;
+ wait(0.5);
+ enable = 1;
+ prevState = 1;
+ }
+ else
+ {
+ enable = 1;
+ direction = 0;
+ }
+}
+
+void goBackward()
+{
+ //Are we changing states?
+ if(prevState == 1)
+ {
+ //Short to ground will occur if parallel H-Bridge Relays are not synchronous when changing states
+ //turn off Run/Stop relay first to prevent short
+ enable = 0;
+ wait(0.5);
+ enable = 1;
+ prevState = 2;
+ }
+ else
+ {
+ enable = 1;
+ direction = 1;
+ }
+}
+
+void goStop()
+{
+ enable = 0;
+}
\ No newline at end of file
