Code sample to be used with Bluemix for education purpose

Dependencies:   C12832 EthernetInterface LM75B MMA7660 MQTT mbed-rtos mbed

Fork of IBMIoTClientEthernetExample by IBM Watson IoT

Files at this revision

API Documentation at this revision

Comitter:
bazot
Date:
Tue Oct 04 07:54:27 2016 +0000
Parent:
18:94da9de96d54
Commit message:
Version 1.0 Module Villes Connect?es

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Aug 12 20:50:56 2015 +0000
+++ b/main.cpp	Tue Oct 04 07:54:27 2016 +0000
@@ -35,10 +35,11 @@
 #define __APP_SW_REVISION__ "18"
 
 // Configuration values needed to connect to IBM IoT Cloud
-#define ORG "quickstart"             // For a registered connection, replace with your org
-#define ID ""                        // For a registered connection, replace with your id
-#define AUTH_TOKEN ""                // For a registered connection, replace with your auth-token
-#define TYPE DEFAULT_TYPE_NAME       // For a registered connection, replace with your type
+#define ORG "!!!!!!"             // For a registered connection, replace with your org
+#define ID  "!!!!!!"              // For a registered connection, replace with your id
+#define AUTH_TOKEN "!!!!!!"                // For a registered connection, replace with your auth-token
+#define TYPE "!!!!!!"      // For a registered connection, replace with your type
+#define DEVICE_NAME "!!!!!!!"     // Replace with your own name
 
 #define MQTT_PORT 1883
 #define MQTT_TLS_PORT 8883
@@ -58,7 +59,7 @@
 #endif
 
 
-bool quickstartMode = true;
+bool quickstartMode = false;
 char org[11] = ORG;  
 char type[30] = TYPE;
 char id[30] = ID;                 // mac without colons
@@ -406,8 +407,9 @@
             
     char buf[250];
     sprintf(buf,
-     "{\"d\":{\"myName\":\"IoT mbed\",\"accelX\":%0.4f,\"accelY\":%0.4f,\"accelZ\":%0.4f,\"temp\":%0.4f,\"joystick\":\"%s\",\"potentiometer1\":%0.4f,\"potentiometer2\":%0.4f}}",
+     "{\"d\":{\"myName\":\"IoT mbed\",\"accelX\":%0.4f,\"accelY\":%0.4f,\"accelZ\":%0.4f,\"temp\":%0.4f,\"joystick\":\"%s\",\"potentiometer1\":%0.4f,\"potentiometer2\":%0.4f,\"Latitude\":43.7,\"Longitude\":7.25,\"Rfid\":12345}}",
             MMA.x(), MMA.y(), MMA.z(), sensor.temp(), joystickPos, ain1.read(), ain2.read());
+     
     message.qos = MQTT::QOS0;
     message.retained = false;
     message.dup = false;
@@ -505,7 +507,7 @@
     int count = 0;
     while (true)
     {
-        if (++count == 100)
+        if (++count == 2500)  // Here is the count to change the number of publish/second
         {               // Publish a message every second
             if (publish(&client, &ipstack) != 0) 
                 attemptConnect(&client, &ipstack);   // if we have lost the connection