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.
CarAPI.h
- Committer:
- ccoleman
- Date:
- 2013-08-22
- Revision:
- 0:2010bcffbae0
- Child:
- 1:8408853a700c
File content as of revision 0:2010bcffbae0:
#ifndef CAR_API_0yx22l34755
#define CAR_API_0yx22l34755
/******************************** Init and Finish ********************************/
void init();
void finish();
/******************************** Wheels and Motor ********************************/
/* turn the car. turnAngle should be between [-1,1] */
void turn(float turnAngle);
/** move forward with the given power, turn angle, for a specified time */
void move(float power, float seconds);
/** move forward with the given powers for each wheel, turn angle, for a specified time */
void move(float leftWheelPower, float rightWheelPower, float seconds);
/** lock the wheels*/
void parkingBrake();
/******************************** INPUTS AND OUTPUTS ********************************/
/** check to see if the car is crashing into something */
bool checkIsCrashing();
/** Return the line direction
line to the left of center. return [-1,0
line to the right of center. return (0,1]
line in center. return 0
*/
float lineDirection();
/* toggle led 0 */
void toggleLED0();
/* toggle led 1 */
void toggleLED1();
/* toggle led 2 */
void toggleLED2();
/* toggle led 3 */
void toggleLED3();
/** is Button B pressed */
bool isButtonBPressed();
/** read Potentiometer 0. returns [-1,1] */
float getPot0();
/** read Potentiometer 1. returns [-1,1] */
float getPot1();
/** How much battery remains. returns [0,1] */
float batteryLife();
/******************************** Changing Variables ********************************/
/** set the base turn offset*/
void setOffset(float _turnOffset);
/** get the base turn offset */
float getOffset();
/** set the base crash sensitivity*/
void setCrashSensitivity(float _sensitivity);
/** return the crash sensitivity */
float getCrashSensitivity();
/** turn on debugging. prints each method call to the serial port*/
void setDebug(bool _debug);
#endif
