Nicolae Marton / Mbed 2 deprecated TDP3_OOP

Dependencies:   mbed

LineFollowingRobot/main.cpp

Committer:
Nicolaemf
Date:
2019-01-26
Revision:
0:a02a278513d9
Child:
1:a2ceed49374e

File content as of revision 0:a02a278513d9:

#include <mbed.h>
#include "RobotControl_H.h"

DigitalIn leftIR(PTC6);
DigitalIn midLeftIR(PTC5);
DigitalIn midIR(PTC4);
DigitalIn midRightIR(PTC3);
DigitalIn rightIR(PTC0);

Ticker sampling;
bool lineSensor[5], toggle2 = false;


void Sample(){
    //function attached to the ticker
    //assigns the data recieved for each digital in into an array
    //toggle is toggled at every ISR, signifying the ISR has occured
    
    lineSensor[0] = leftIR;
    lineSensor[1] = midLeftIR;
    lineSensor[2] = midIR;
    lineSensor[3] = midRightIR;
    lineSensor[4] = rightIR;
    
    toggle2 = !toggle2;
}




int main(){

//get a first reading
Sample();
sampling.attach(&Sample, 0.01);

RobotControl controlLeft(PTC12,PTD4,PTA5);
RobotControl controlRight(PTA13,PTA12,PTA4);


 
 while(1){
    wait(1);
    }   
    
}