asdf

Dependencies:   L3GD20 LSM303DLHC mbed

Main.cpp

Committer:
goy5022
Date:
2014-04-03
Revision:
8:ce5b1bf38077
Parent:
7:95ebadc83fc7

File content as of revision 8:ce5b1bf38077:

//#include "Core.h"

#include "Sensors.h"
#include "PID.h"
#include "Communication.h"
#include "Flooding.h"
#include "Movement.h"

#include "BufferAverage.h"
#include "ExponentialAverage.h"
//#include "WeightedAverage.h"

int main()
{
    Motor.baud(115200);
    ledF.period_us(26.3); //28.5 //27.9
    wait_us(600);
    ledF.write(.5);
    stop_mov();
    
    
    wait(3);
    /*

    STEVE!!!!!!
    WHENEVER YOU ARE IN A CELL AND YOU WANT TO KNOW WHAT THE NEXT BEST MOVE IS
    USE THE flood_findPath(x, y)  where x and y are your current possition
    
    the function will return a MOVE type
    and you can use something similar to this:

    i've written the code for the following:
    
    
    moveNORTH()
    moveSOUTH()
    moveEAST()
    moveWEST()
    
    they are at the bottom of the page. take a look and read them.
    
    
    REMEMBER TO MOVE THEM TO THE TOP OF THE PAGE IF YOU PLAN TO USE THEM IN THE MAIN FUNCTION, OR VICEVERSA MOVE THE MAIN FUNC.
    TO THE BOTTOM
    
    */

    //initMapping();
    initSensors();
    setRightSpeed(3);
    setLeftSpeed(3);
    t.start();
    
    //while (true)
    //while(SenseF.read() < 0.99)
    //while(true)
        //{
        t.reset();
        while(frontExpAvg.average() < .8 && wallRight() && wallLeft()) 
        { 
            frontExpAvg.add(SenseF.read());
            
            pid();
               
        }
        
        float time = t.read();
        handbrake();
        wait_ms(200);
        //updateMaze();
        //WIRELESS.printf("Time: %f Cells: %i\n\r", time, cells_traveled);
        //printMap(WIRELESS);
        //if (frontExpAvg.average() < .8 && !wallRight() && wallLeft())
            turn_right(3);
        //if (frontExpAvg.average() < .8 && wallRight() && !wallLeft())
        //    turn_left(3);
       // }
     
     
    return 0;
}