五力全開 / Mbed 2 deprecated Robotics_test1

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 #include "mbed.h"
00003 #include "Define.h"
00004 
00005 
00006 //////////////////////////////Init
00007 
00008 Serial pc(SERIAL_TX, SERIAL_RX);
00009 DigitalIn Switch_0(D4);
00010 DigitalIn Switch_1(D3);
00011 DigitalOut LED_Red(D5);
00012 DigitalOut LED_2(A4);
00013 DigitalOut LED_3(A5);
00014 AnalogIn BatteryVot(A0);
00015 //DigitalIn Switch_2(D2);
00016 //DigitalIn Switch_3(D3);
00017 
00018 
00019 //////////////////////////////////////////////////////////////////////
00020 
00021 
00022 /////////////////////////////globle
00023 double NowCoordinate[2], LastCoordinate[2];
00024 double NowFaceAngle, NowDirectionInRad;
00025 long   SelfRotation;
00026 double TargetCoordinate[2];
00027 double Goal_1_Coordinate[2], Goal_2_Coordinate[2], Ball_Coordinate[2], Last_Ball_Coordinate[2], Enemy_Ball_Coordinate[2];//, Ball_2_Coordinate[2];
00028 bool   TargetCoordinateValid;
00029 double Car1XforStra1, Car1YforStra1, Car1DirectionforStra1, BlueBallXforStra1, BlueBallYforStra1, GreenBallXforStra1, GreenBallYforStra1;
00030 double Car2XforStra1, Car2YforStra1, Car2DirectionforStra1;
00031 int WatchDogCounts = 0;
00032 
00033 /////////////////////////////////////////
00034 #include "WatchDog.h"
00035 #include "DebugBluetooth.h"
00036 #include "OutputToMotor.h"
00037 #include "Interrupt.h"
00038 
00039 //#include "bluetooth.h"
00040 #include "NewBluetooth.h"
00041 #include "strategy1.h"
00042 #include "setup.h"
00043 #include "loop.h"
00044 #include "Function.h"
00045 
00046 
00047 
00048 void InitIO(void)
00049 {
00050     Switch_0.mode(PullUp);
00051     Switch_1.mode(PullUp);
00052     //Switch_2.mode(PullUp);
00053     //Switch_3.mode(PullUp);
00054     LED_2 = 0;
00055     LED_3 = 0;    
00056 }
00057 
00058 int main() 
00059 {
00060     InitIO();
00061     setup();
00062     OutputInit();
00063     while(1)
00064     {
00065         loop();
00066         
00067     }    
00068 }