Arend Peter Castelein / Alexa_Inventory

Dependencies:   LSM9DS1_Library_cal Motordriver

main.cpp

Committer:
apcastelein
Date:
2016-11-28
Revision:
2:c91ce1f091f5
Parent:
1:849b06ea572d
Child:
3:b65b394375b7

File content as of revision 2:c91ce1f091f5:

#include "mbed.h"

// Sends a request to the server and waits for a path response
char* getPathFromServer(){
    //use wifi module here
    //https://developer.mbed.org/users/electromotivated/notebook/wifi-pid-redbot-robot-webserver/    
    char* path = "";
    return path;
}

//gets the orientation from imu
float getDirection(){
    ///tests    
}

//technologies for navigation may include
// - Line following https://www.sparkfun.com/products/11769
// - IMU https://developer.mbed.org/cookbook/Stinger-Robot-Library
// - color sensor (indicates when end of movement is reached)
void moveForward(){}
void rotateLeft(){}
void rotateRight(){}

//arem technology is yet to be determined, will probably involve adjusting a motor
void armUp(){}
void armDown(){}

// Loops through path commands and executes each one sequentially
void executePath(char* path){
    int index = 0;
    while(path[index] != '\0'){
        switch(path[index]){
            case 'F': moveForward(); break;    
            case 'L': rotateLeft(); break;
            case 'R': rotateRight(); break;
            case 'U': armUp(); break;
            case 'U': armDown(); break;
        }    
    }
}

int main() {
    while(true){
        char* path = getPathFromServer(); 
        executePath(path);
    }
}