In this 20-min video you will learn how to connect your TI CC3200 LaunchPad to the Internet of Things using MQTT.
Once your board is pushing data using MQTT, not only can you test that everything is properly working by using the MQTTLens Chrome app mentioned in the video, but you can use virtually any MQTT client to consume the data and display it on a chart, store it in a database, etc.
The MQTTTask code is as follows, in case you'd like to copy-paste it
static void MQTTTask(void *pvParameters) { while(g_iInternetAccess != 0) { osi_Sleep(200); } while(1) { // publish temperature using MQTT MQTTPacket_connectData data = MQTTPacket_connectData_initializer; int rc = 0; char buf[200]; MQTTString topicString = MQTTString_initializer; float fCurrentTemp; TMP006DrvGetTemp(&fCurrentTemp); char cTemp = (char)fCurrentTemp; char payload[20]; memset(payload, '\0', sizeof(payload)); short sTempLen = itoa(cTemp,payload); payload[sTempLen++] = ' '; payload[sTempLen++] = 'F'; payload[sTempLen] = '\0'; int payloadlen = strlen(payload); int buflen = sizeof(buf); data.clientID.cstring = "me"; data.keepAliveInterval = 20; data.cleansession = 1; int len = MQTTSerialize_connect(buf, buflen, &data); /* 1 */ topicString.cstring = "cc3200-ben"; len += MQTTSerialize_publish(buf + len, buflen - len, 0, 0, 0, 0, topicString, payload, payloadlen); /* 2 */ len += MQTTSerialize_disconnect(buf + len, buflen - len); /* 3 */ int mysock = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, 0); SlSockAddrIn_t addr; addr.sin_family = SL_AF_INET; addr.sin_port = sl_Htons(1883); addr.sin_addr.s_addr = sl_Htonl(0xC6291EF1); sl_Connect(mysock, (SlSockAddr_t *) &addr, sizeof(addr)); sl_Send(mysock, buf, len, NULL); sl_Close(mysock); osi_Sleep(1000); } }