demo project

Dependencies:   AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL

main.cpp

Committer:
henryrawas
Date:
2016-01-15
Revision:
13:ffeff9b5e513
Parent:
10:9b21566a5ddb
Child:
18:224289104fc0

File content as of revision 13:ffeff9b5e513:

#include "mbed.h"
#include "rtos.h"

#include <Terminal.h>
#include <ControllerIo.h>


using namespace std;

Terminal pc(USBTX, USBRX);

extern void PrepareController();
extern void RunController();
extern bool StartIothubThread();


int main()
{
    pc.baud(115200); 

    pc.cls();
    pc.foreground(Yellow);
    pc.background(Black);

    pc.locate(0, 0);
    pc.printf("**********************\r\n");
    pc.printf("RobotArmDemo start\r\n");
    pc.printf("**********************\r\n");

    pc.foreground(Teal);
    pc.background(Black);

    ShowLedGreen();
    
    // prepare the motion sequences
    PrepareController();
    
    // start IotHub connection
    StartIothubThread();
    
    // time delay is to allow the position encoders to come online after initial power supply event ~ 5 secs
    // and to allow IoTHub SSL connection established
    Thread::wait(15000);
    
    pc.printf("Initialization done. Ready to run. \r\n");

    // try running this thread at a higher priority
    osThreadId maintid = osThreadGetId();
    osThreadSetPriority(maintid, osPriorityHigh);
    
    RunController(); 
}