MRJJ / clickers

Dependents:   ROCO104_Buggy BuggyDesign

clickers.cpp

Committer:
jakesmart
Date:
2020-03-06
Revision:
2:2571dd52276f
Parent:
1:d5b76569b45c
Child:
3:91541ffdf9a5

File content as of revision 2:2571dd52276f:

#include "mbed.h"
#include "motor.h"
#include "clickers.h"
#include "UltraSonic.h"

extern DigitalIn microswitch1;       //Instance of the DigitalIn class called 'microswitch1'
extern DigitalIn microswitch2;       //Instance of the DigitalIn class called 'microswitch2'
extern Motor Wheel;
extern Serial pc;
extern int mm;
extern void dist();
extern bool rStopped, fStopped;

void RevStop()
{
    while (microswitch1 == true)
    {
        microswitch1.read();        
        Wheel.Stop();
        rStopped = true;
    }

void FwdStop()
{
    while (mm<= 500)
    {
        ultra_sonic_distance();
        Wheel.Stop();
        fStopped = true
        dist();
    }
}