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
TrollingMotor.h
- Committer:
- Spilly
- Date:
- 2015-04-27
- Revision:
- 8:c77ab7615b21
- Child:
- 12:273479524c71
File content as of revision 8:c77ab7615b21:
/*************************************************************************************************************************************************************/
// 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;
}
