demo project
Dependencies: AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL
Revision 24:f6aa0e64c5e1, committed 2016-01-27
- Comitter:
- henryrawas
- Date:
- Wed Jan 27 19:59:21 2016 +0000
- Parent:
- 23:381b6c77a6a0
- Child:
- 25:acc34bcf563e
- Commit message:
- make up/down repeat
Changed in this revision
--- a/IothubRobotArm.cpp Tue Jan 26 20:26:24 2016 +0000 +++ b/IothubRobotArm.cpp Wed Jan 27 19:59:21 2016 +0000 @@ -23,8 +23,9 @@ #include "certs.h" #endif // MBED_BUILD_TIMESTAMP -// TODO: move to config file -static const char* connectionString = "[Insert ITHub connection string here]"; +/*String containing Hostname, Device Id & Device Key in the format: */ +/* "HostName=<host_name>;DeviceId=<device_id>;SharedAccessKey=<device_key>" */ +static const char* connectionString = "[device connection string]"; extern void ShowLedColor(int col); @@ -218,7 +219,14 @@ callbackCounter = 0; msgNumber = 0; - (void)printf("Starting the IoTHub RobotArm sample AMQP...\r\n"); + (void)printf("Starting the IoTHub RobotArm connection\r\n"); + + if (connectionString[0] == '[') + { + // forgot to replace placeholder + (void)printf("ERROR: connectionString is not set to a device connection!\r\n"); + return false; + } if ((iotHubClientHandle = IoTHubClient_Mod_CreateFromConnectionString(connectionString, AMQP_Protocol)) == NULL) { @@ -228,7 +236,6 @@ else { #ifdef MBED_BUILD_TIMESTAMP - (void)printf("INFO: IoTHubClient_SetOption\r\n"); // For mbed add the certificate information if (IoTHubClient_Mod_SetOption(iotHubClientHandle, "TrustedCerts", certificates) != IOTHUB_CLIENT_OK) {
--- a/Sequences.cpp Tue Jan 26 20:26:24 2016 +0000 +++ b/Sequences.cpp Wed Jan 27 19:59:21 2016 +0000 @@ -51,6 +51,7 @@ ActionSequence* loop10 = new ActionSequence(SA_LoopBegin, 0 , NULL, 10); ActionSequence* loop20 = new ActionSequence(SA_LoopBegin, 0 , NULL, 20); + ActionSequence* loop1000 = new ActionSequence(SA_LoopBegin, 0 , NULL, 1000); ActionSequence* loop2 = new ActionSequence(SA_LoopBegin, 0 , NULL, 2); ActionSequence* loopEnd = new ActionSequence(SA_LoopEnd); ActionSequence* pause100ms = new ActionSequence(SA_Delay, 0 , NULL, 100); @@ -74,11 +75,12 @@ // add actions into UpDownSeq UpDownSeq.clear(); - UpDownSeq.push_back(moveUp); - UpDownSeq.push_back(pause1); + UpDownSeq.push_back(loop1000); UpDownSeq.push_back(moveDown); UpDownSeq.push_back(pause1); UpDownSeq.push_back(moveUp); + UpDownSeq.push_back(pause1); + UpDownSeq.push_back(loopEnd); // add actions into RightStepsSeq // move to vertical, then move each part one at a time, then return to home
--- a/main.cpp Tue Jan 26 20:26:24 2016 +0000 +++ b/main.cpp Wed Jan 27 19:59:21 2016 +0000 @@ -42,8 +42,7 @@ 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); + Thread::wait(5000); pc.printf("Initialization done. Ready to run. \r\n");