Starting point for the student buggy project
Fork of microbit-hello-world by
Buggy.h
- Committer:
- OyaideA
- Date:
- 2017-08-06
- Revision:
- 4:2d939ef2b09c
- Parent:
- 3:c3a42966b47c
- Child:
- 5:a33f016d5962
File content as of revision 4:2d939ef2b09c:
/* 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); void TestAntiCollision(unsigned int Voltage, unsigned int Time_ms, unsigned int SonarTime_us); void MotorSpeedCharacterisation(void); extern MicroBit uBit; #endif