Use the STM32F411 Nucleo Board, Nucleo Sensor Shield, WIZnet5500 Ethernet to upload temperature data to M2X
Dependencies: M2XStreamClient Nucleo_Sensor_Shield WIZnet_Library jsonlite mbed
Fork of M2X_Nucleo411_ESP8266-wifi by
Diff: main.cpp
- Revision:
- 1:c7b9e522cc8e
- Parent:
- 0:ece599ab76bb
- Child:
- 2:68b759c89fd9
diff -r ece599ab76bb -r c7b9e522cc8e main.cpp --- a/main.cpp Tue Aug 05 14:46:55 2014 +0000 +++ b/main.cpp Sat Aug 29 17:11:28 2015 +0000 @@ -12,9 +12,9 @@ #define min(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; }) #endif -const char key[] = "<key>"; // Replace with your M2X user account master key -const char feed[] = "<feed>"; // Replace with your blueprint feed ID -const char stream[] = "<stream>"; // Replace with your stream name +char deviceId[] = "<device id>"; // Device you want to push to +char streamName[] = "<stream name>"; // Stream you want to push to +char m2xKey[] = "<m2x api key>"; // Your M2X API Key or Master API Key int main() { @@ -30,7 +30,7 @@ // Initialize the M2X client Client client; - M2XStreamClient m2xClient(&client, key); + M2XStreamClient m2xClient(&client, m2xKey); int ret; // Create an accelerometer instance @@ -58,9 +58,9 @@ // If the maximum title is over 20 degrees, then send // data to stream if (maxTilt > 20) { - ret = m2xClient.post(feed, stream, maxTilt); + ret = m2xClient.updateStreamValue(deviceId, streamName, maxTilt); printf("send() returned %d\r\n", ret); - // wait(0.5); + wait(0.5); } } } \ No newline at end of file