Starting point for the student buggy project
Fork of microbit-hello-world by
Diff: Buggy.h
- Revision:
- 2:47b7a55b0805
- Child:
- 3:c3a42966b47c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Buggy.h Mon Jul 31 21:48:36 2017 +0000 @@ -0,0 +1,45 @@ +/* +This file contains the main function prototypes for the Buggy project +*/ +#ifndef _BUGGY_H_ +#define _BUGGY_H_ + +#include "MicroBit.h" + +/******************************************************************* +Definition of global constants to control how to move the buggy +*******************************************************************/ +#define MOVE_FORWARD 0 +#define MOVE_BACKWARD 1 +#define ROTATE_CLOCKWISE 2 +#define ROTATE_ANTICLOCKWISE 3 + + + +void PauseLastCommand(); +void ContinueLastCommand(); +bool hasLastCommandCompleted(); +void InitialiseBuggy(); +unsigned int GetSonarTime_us(); + +/****************************************************************************** +Function to run a basic test of the buggy's motors. The buggy will perform the +following moves: move backwards, move forwards, rotate clockwise, rotate +anticlockwise. Each movement will continue for a user-defined time period. There +will be a pause period between each movement. +The function inputs are: +Voltage: the voltage you want to run the motor at. 0(off) to 1024(fast) +Time_ms: the length of time you want each movement to occur for +Pause_ms: the pause period between each motor move +*******************************************************************************/ +void RunBasicBuggyMotorTest(unsigned int Voltage, unsigned int Time_ms, unsigned int Pause_ms); + +void TestSonar(); + +void PrintSonarTiming(void); + +extern MicroBit uBit; + + + +#endif