Starting point for the student buggy project

Dependencies:   microbit

Fork of microbit-hello-world by micro:bit

Buggy.h

Committer:
OyaideA
Date:
2017-07-31
Revision:
3:c3a42966b47c
Parent:
2:47b7a55b0805
Child:
4:2d939ef2b09c

File content as of revision 3:c3a42966b47c:

/*
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);

extern MicroBit uBit;



#endif