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
Actuator.h
- Committer:
- Spilly
- Date:
- 2015-04-29
- Revision:
- 12:273479524c71
- Parent:
- 8:c77ab7615b21
- Child:
- 14:fd20b7ac8de8
File content as of revision 12:273479524c71:
/*************************************************************************************************************************************************************/ // Created by: Ryan Spillman // // Last updated 4/9/2015 // // Contains functions for controlling L298n H-bridge which controls the linear actuator /*************************************************************************************************************************************************************/ #define Actuator_h //L298n connections DigitalOut pinI1(D7); DigitalOut pinI2(PTC12); //D8 PwmOut ENA(D6); /*************************************************************************************************************************************************************/ // L298n (H-Bridge) Functions /*************************************************************************************************************************************************************/ void turnStop(float valueOne, float valueTwo) { pinI1 = 0; pinI2 = 0; ENA = valueOne; } void turnLeft(float valueOne, float valueTwo) { pinI1 = 0; pinI2 = 1; ENA = valueOne; } void turnRight(float valueOne, float valueTwo) { pinI1 = 1; pinI2 = 0; ENA = valueOne; } //calculate an equal distance from acuator center point that the acutator can physically move to without hitting limit switch float calcEnds(float center, float max, float min) { float upperRange = max - center; float lowerRange = center - min; if(upperRange < lowerRange) { return upperRange; } else { return lowerRange; } }