robot arm demo team / Mbed 2 deprecated RobotArmDemo Featured

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // Copyright (c) Microsoft. All rights reserved.
00002 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
00003 
00004 #include "mbed.h"
00005 #include "rtos.h"
00006 
00007 #include "mbed/logging.h"
00008 
00009 #include "RobotArmCfg.h"
00010 #include "ControllerIo.h"
00011 
00012 extern void PrepareController();
00013 extern void RunController();
00014 extern bool StartIothubThread();
00015 
00016 
00017 int main()
00018 {
00019     mbed_log_init();
00020 
00021     printf("**********************\r\n");
00022     printf("RobotArmDemo start\r\n");
00023     printf("**********************\r\n");
00024 
00025     ShowLedGreen();
00026     
00027     ReadConfigValues();
00028     
00029     // prepare the motion sequences
00030     PrepareController();
00031     
00032     // start IotHub connection
00033     StartIothubThread();
00034     
00035     // time delay is to allow the position encoders to come online after initial power supply event ~ 5 secs
00036     Thread::wait(5000);
00037     
00038     printf("Initialization done. Ready to run. \r\n");
00039 
00040     // try running this thread at a higher priority
00041     osThreadId maintid = osThreadGetId();
00042     osThreadSetPriority(maintid, osPriorityHigh);
00043     
00044     RunController(); 
00045 }