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: MQTT Nucleo_Sensor_Shield mbed-src
Diff: main.cpp
- Revision:
- 1:0535928f65ca
- Parent:
- 0:d87e01c5969f
diff -r d87e01c5969f -r 0535928f65ca main.cpp
--- a/main.cpp Thu Jun 04 23:36:46 2015 +0000
+++ b/main.cpp Mon Jun 08 20:06:56 2015 +0000
@@ -1,17 +1,10 @@
/* All modem code Aeris code and have been removed to get the ST Mems sensor board to function initially.
* This was done to see if anything was working at all. Currently the sensors are read every 33 seconds.
* This can be changed to a higher speed to capture more interesting events.
- * The oringinal code worked for a Future FAE training event utilizing a st411 processor and a Multitech
- * socket modem H5 version.
*/
-
-
-
-
/* This is an example program which reads in the 3-axis acceleration, pressure, and temperature data from
- * a sensor board. It then uses an MTSAS SocketModem Shield board to send the read data over
- * a cellular connection to Aeris AerCloud using an MQTT client protocol.
+ * a sensor board. It then uses the Dragonfly board to send the read data over a cellular connection to Aeris AerCloud using an MQTT client protocol.
*/
#include "mbed.h"
@@ -60,23 +53,23 @@
// const char _APN[] = "aer.aerisapn.net"; // Cellular provider APN address for data services
// const char _APN[] = "aer05.aerisapn.net";
-char _AERCLOUD_API_KEY[] ="_Click_On_KEY_AerCloud_Tab";
-char _AERCLOUD_ACCOUNT_ID[] = "_Company_Number_Top_of_Page"; // account ID.
-char _AERCLOUD_CONTAINER[] = "_From_Container_Page"; // new container name
-char _AERCLOUD_DEVICE_ID[] = "_Random_Title"; // title with unique identifier, i.e. last 4 digits of IMEI
-char _AERCLOUD_SUBSCRIPTION_ID[] = "_Random_Subscription_ID"; // created at Continer Name then Subscription ID for LongPoll
-
-char _host[] = "mqtt.aercloud.aeris.com";
-int _port = 1883;
+//char _AERCLOUD_API_KEY[] ="_Click_On_KEY_AerCloud_Tab";
+//char _AERCLOUD_ACCOUNT_ID[] = "_Company_Number_Top_of_Page"; // account ID.
+//char _AERCLOUD_CONTAINER[] = "_From_Container_Page"; // new container name
+//char _AERCLOUD_DEVICE_ID[] = "_Random_Title"; // title with unique identifier, i.e. last 4 digits of IMEI
+//char _AERCLOUD_SUBSCRIPTION_ID[] = "_Random_Subscription_ID"; // created at Continer Name then Subscription ID for LongPoll
+//
+//char _host[] = "mqtt.aercloud.aeris.com";
+//int _port = 1883;
#define DATA_INTERVAL 30 // delay between samples, could be reduced for quicker response and more data
-void callback(char* topic, char* payload, unsigned int len)
-{
- logInfo("topic: [%s]\r\npayload: [%s]", topic, payload);
-}
-
+//void callback(char* topic, char* payload, unsigned int len)
+//{
+// logInfo("topic: [%s]\r\npayload: [%s]", topic, payload);
+//}
+//
DigitalOut myled(PA_0); // D3
//Serial pc(PA_2, PA_3); // D1-PA_2-SERIAL_TX, D0-PA_3-SERIAL_RX
volatile float TEMPERATURE_Value_C;
@@ -89,7 +82,7 @@
int main()
{
- printf("\r\n\r\nHello FUTURE!\r\n\r\n");
+ printf("\r\n\r\nHello!\r\n\r\n");
MTSLog::setLogLevel(MTSLog::TRACE_LEVEL);
// for Nucleo boards
@@ -167,9 +160,9 @@
printf("Temperature:\t\t %f C\r\n", TEMPERATURE_Value_C );
printf("Pressure:\t\t %f hPa\r\n", PRESSURE_Value);
printf("Accelerometer (mg):\t X: %d, Y: %d, Z: %d\r\n", ACC_Value.AXIS_X, ACC_Value.AXIS_Y, ACC_Value.AXIS_Z);
-// pc.printf("Humidity:\t\t %f%%\r\n", HUMIDITY_Value);
-// pc.printf("Magnetometer (mGauss):\t mX: %d, mY: %d, mZ: %d\r\n", MAG_Value.AXIS_X, MAG_Value.AXIS_Y, MAG_Value.AXIS_Z);
-// pc.printf("Gyroscope (mdps):\t X: %d, Y: %d, Z: %d\r\n", GYR_Value.AXIS_X, GYR_Value.AXIS_Y, GYR_Value.AXIS_Z);
+// printf("Humidity:\t\t %f%%\r\n", HUMIDITY_Value);
+// printf("Magnetometer (mGauss):\t mX: %d, mY: %d, mZ: %d\r\n", MAG_Value.AXIS_X, MAG_Value.AXIS_Y, MAG_Value.AXIS_Z);
+// printf("Gyroscope (mdps):\t X: %d, Y: %d, Z: %d\r\n", GYR_Value.AXIS_X, GYR_Value.AXIS_Y, GYR_Value.AXIS_Z);
printf("\r\n");
myled = 1; // LED is ON