五力全開 / Mbed 2 deprecated Robotics_test1

Dependencies:   mbed

main.cpp

Committer:
Nthu_Five
Date:
2016-06-16
Revision:
6:434bb72ffc26
Parent:
5:aab0171a8065
Child:
7:1818632c0b60

File content as of revision 6:434bb72ffc26:


#include "mbed.h"
#include "Define.h"


//////////////////////////////Init

Serial pc(SERIAL_TX, SERIAL_RX);
DigitalIn Switch_0(D4);
DigitalIn Switch_1(D1);
DigitalOut LED_Red(D5);
DigitalOut LED_2(A4);
DigitalOut LED_3(A5);
AnalogIn BatteryVot(A0);
//DigitalIn Switch_2(D2);
//DigitalIn Switch_3(D3);


//////////////////////////////////////////////////////////////////////


/////////////////////////////globle
double NowCoordinate[2], LastCoordinate[2];
double NowFaceAngle, NowDirectionInRad;
long   SelfRotation;
double TargetCoordinate[2];
double Goal_1_Coordinate[2], Goal_2_Coordinate[2], Ball_Coordinate[2], Last_Ball_Coordinate[2], Enemy_Ball_Coordinate[2];//, Ball_2_Coordinate[2];
bool   TargetCoordinateValid;
double Car1XforStra1, Car1YforStra1, Car1DirectionforStra1, BlueBallXforStra1, BlueBallYforStra1, GreenBallXforStra1, GreenBallYforStra1;
double Car2XforStra1, Car2YforStra1, Car2DirectionforStra1;
int WatchDogCounts = 0;

/////////////////////////////////////////
#include "WatchDog.h"
#include "DebugBluetooth.h"
#include "OutputToMotor.h"
#include "Interrupt.h"

//#include "bluetooth.h"
#include "NewBluetooth.h"
#include "strategy1.h"
#include "setup.h"
#include "loop.h"
#include "Function.h"



void InitIO(void)
{
    Switch_0.mode(PullUp);
    Switch_1.mode(PullUp);
    //Switch_2.mode(PullUp);
    //Switch_3.mode(PullUp);
    LED_2 = 0;
    LED_3 = 0;    
}

int main() 
{
    InitIO();
    setup();
    OutputInit();
    while(1)
    {
        loop();
        
    }    
}