demo project
Dependencies: AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL
main.cpp@27:4239713d9690, 2016-02-02 (annotated)
- Committer:
- henryrawas
- Date:
- Tue Feb 02 00:47:57 2016 +0000
- Revision:
- 27:4239713d9690
- Parent:
- 26:6def77499117
use config file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
henryrawas | 19:2f0ec9ac1238 | 1 | // Copyright (c) Microsoft. All rights reserved. |
henryrawas | 19:2f0ec9ac1238 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
henryrawas | 19:2f0ec9ac1238 | 3 | |
jepickett | 0:547ac906c46b | 4 | #include "mbed.h" |
henryrawas | 4:36a4eceb1b7f | 5 | #include "rtos.h" |
henryrawas | 4:36a4eceb1b7f | 6 | |
henryrawas | 27:4239713d9690 | 7 | #include "mbed/logging.h" |
henryrawas | 27:4239713d9690 | 8 | |
henryrawas | 27:4239713d9690 | 9 | #include "RobotArmCfg.h" |
henryrawas | 18:224289104fc0 | 10 | #include "ControllerIo.h" |
henryrawas | 7:6723f6887d00 | 11 | |
henryrawas | 13:ffeff9b5e513 | 12 | extern void PrepareController(); |
henryrawas | 7:6723f6887d00 | 13 | extern void RunController(); |
henryrawas | 7:6723f6887d00 | 14 | extern bool StartIothubThread(); |
henryrawas | 4:36a4eceb1b7f | 15 | |
jepickett | 0:547ac906c46b | 16 | |
jepickett | 0:547ac906c46b | 17 | int main() |
jepickett | 0:547ac906c46b | 18 | { |
henryrawas | 27:4239713d9690 | 19 | mbed_log_init(); |
henryrawas | 27:4239713d9690 | 20 | |
henryrawas | 26:6def77499117 | 21 | printf("**********************\r\n"); |
henryrawas | 26:6def77499117 | 22 | printf("RobotArmDemo start\r\n"); |
henryrawas | 26:6def77499117 | 23 | printf("**********************\r\n"); |
jepickett | 2:37021fb3b45b | 24 | |
henryrawas | 10:9b21566a5ddb | 25 | ShowLedGreen(); |
henryrawas | 4:36a4eceb1b7f | 26 | |
henryrawas | 27:4239713d9690 | 27 | ReadConfigValues(); |
henryrawas | 27:4239713d9690 | 28 | |
henryrawas | 13:ffeff9b5e513 | 29 | // prepare the motion sequences |
henryrawas | 13:ffeff9b5e513 | 30 | PrepareController(); |
henryrawas | 13:ffeff9b5e513 | 31 | |
henryrawas | 4:36a4eceb1b7f | 32 | // start IotHub connection |
henryrawas | 4:36a4eceb1b7f | 33 | StartIothubThread(); |
jepickett | 2:37021fb3b45b | 34 | |
henryrawas | 4:36a4eceb1b7f | 35 | // time delay is to allow the position encoders to come online after initial power supply event ~ 5 secs |
henryrawas | 24:f6aa0e64c5e1 | 36 | Thread::wait(5000); |
henryrawas | 4:36a4eceb1b7f | 37 | |
henryrawas | 26:6def77499117 | 38 | printf("Initialization done. Ready to run. \r\n"); |
jepickett | 2:37021fb3b45b | 39 | |
henryrawas | 13:ffeff9b5e513 | 40 | // try running this thread at a higher priority |
henryrawas | 13:ffeff9b5e513 | 41 | osThreadId maintid = osThreadGetId(); |
henryrawas | 13:ffeff9b5e513 | 42 | osThreadSetPriority(maintid, osPriorityHigh); |
henryrawas | 13:ffeff9b5e513 | 43 | |
henryrawas | 7:6723f6887d00 | 44 | RunController(); |
henryrawas | 4:36a4eceb1b7f | 45 | } |