Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mtsas FXAS21002 FXOS8700 mbed-rtos
Fork of AvnetWorking_IBM_QuickStart by
Revision 7:3d2a3fd4a523, committed 2016-08-23
- Comitter:
- BlueShadow
- Date:
- Tue Aug 23 02:46:22 2016 +0000
- Parent:
- 6:8f1ad9d2193e
- Commit message:
- Class ready example for Bluemix, NXP Freescale sensor, Aeris, Dragonfly
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Aug 23 02:17:54 2016 +0000
+++ b/main.cpp Tue Aug 23 02:46:22 2016 +0000
@@ -1,6 +1,6 @@
-/** Combination of MultiTech HTTPS Example using json with ROHM Sennsor board and IBM Bluemix
+/** Combination of MultiTech HTTPS Example using json with NXP Freescale sensor board and IBM Bluemix
*
- * Configures the Sensor board for Ambient Light, cellular radio, brings up the cellular link,
+ * Configures the Sensor board for Accelerometer, cellular radio, brings up the cellular link,
* and does HTTPS POST requests.
* To do HTTPS requests with a certain server, the root certificate used to validate that server's certificate must be installed. See ssl_certificates.h for information on how to get the proper root certificate.
*
@@ -10,22 +10,14 @@
* - MultiTech UDK2 (4" square white PCB with Arduino headers, antenna
* connector, micro USB ports, and 40-pin connector for Dragonfly)
* - MultiTech Dragonfly (1"x2" green PCB with Telit radio)
- * - Rohm Electronics Sensor Board
- * - Expansion board (LSM6DS0
- * 3-axis accelerometer + 3-axis gyroscope, LIS3MDL 3-axis
- * magnetometer, HTS221 humidity and temperature sensor and LPS25HB
- * pressure sensor)
+ * - Freescale (NXP) Sensor Board
*
* What this program does:
- * - reads data from all sensors on board
+ * - reads data from sensor
* - prints all sensor data to debug port on a periodic basis
- * - optionally send data to BlueMix
+ * - sends data to BlueMix
* - All data is sent to a specific location determined by the student login.
* - BlueMix cloud platform (user must create own account and configure a device
- * - you need to set the "VENDOR" and "MODEL"
-
- * - you need to set the "do_cloud_post" flag to true for this to
- * work
*
* Setup:
* - Correctly insert SIM card into Dragonfly
@@ -35,24 +27,11 @@
* - Stack the MEMs board on top of the Base Shield
* - Plug in the power cable
* - Plug a micro USB cable into the port below and slightly to the
- * left of the Dragonfly (NOT the port on the Dragonfly)
+ * left of the Dragonfly near the RF Connector (NOT the port on the Dragonfly)
*
* Go have fun and make something cool!
*
************************************************************************/
-/*
-Sample Program Description:
- This Program will enable to Multi-Tech Dragonfly platform to utilize ROHM's Multi-sensor Shield Board.
- This program will initialize all sensors on the shield and then read back the sensor data.
- Data will then be output to the UART Debug Terminal every 1 second.
-
-Sample Program Author:
- ROHM USDC
-
-Additional Resources:
- ROHM Sensor Shield GitHub Repository: https://github.com/ROHMUSDC/ROHM_SensorPlatform_Multi-Sensor-Shield
- * NOTE: This example changes the baud rate of the debug port to 115200 baud!
- */
#include "mbed.h"
#include "mtsas.h"
@@ -91,7 +70,7 @@
mts::Cellular* radio;
// An APN is required for GSM radios.
-static const char apn[] = "iot.aer.net";
+static const char apn[] = "";
bool radio_ok = false;
@@ -116,12 +95,9 @@
printf("Begin Data Acquisition from FXOS8700 and FXAS21002....\r\n\r\n");
wait(0.5);
-
-
// Disable the battery charger unless a battery is attached.
bc_nce = 1;
-
// Change the baud rate of the debug port from the default 9600 to 115200.
Serial debug(USBTX, USBRX);
debug.baud(115200);
@@ -143,7 +119,6 @@
}
}
-
logInfo("setting APN");
if (radio->setApn(apn) != MTS_SUCCESS)
logError("failed to set APN to \"%s\"", apn);
@@ -191,7 +166,6 @@
if (http.addRootCACertificate(ssl_certificates) != HTTP_OK)
logError("loading SSL certificates failed");
-
char http_rx_buf[1024];
char http_tx_buf[1024];
@@ -209,8 +183,8 @@
HTTPJson http_tx(http_tx_buf, strlen(http_tx_buf)+1);
// Make a HTTP POST request to http://httpbin.org/
- res = http.post("http://quickstart.internetofthings.ibmcloud.com/api/v0002/device/types/dragonflytype/devices/dragonfly22/events/myEvent", http_tx, &http_rx);
-// res = http.post("http://quickstart.internetofthings.ibmcloud.com/api/v0002/device/types/dragonflytype/devices/ REPLACE WITH DEVICEID /events/myEvent", http_tx, &http_rx);
+// res = http.post("http://quickstart.internetofthings.ibmcloud.com/api/v0002/device/types/dragonflytype/devices/dragonfly22/events/myEvent", http_tx, &http_rx);
+ res = http.post("http://quickstart.internetofthings.ibmcloud.com/api/v0002/device/types/dragonflytype/devices/ REPLACE WITH DEVICEID /events/myEvent", http_tx, &http_rx);
if (res != HTTP_OK)
logError("HTTPS POST to Bluemix failed [%d][%s]", res, httpResToStr(res));
else
