The library is designed to connect the MBED boards to the ThingSpeak IoT cloud.
Fork of Thingspeak by
Thingspeak.h@0:d98f92bb426f, 2018-02-12 (annotated)
- Committer:
- mreda
- Date:
- Mon Feb 12 10:18:15 2018 +0000
- Revision:
- 0:d98f92bb426f
- Child:
- 1:0c196a572d6b
Thingspeak_v1_post
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mreda | 0:d98f92bb426f | 1 | #ifndef MBED_THINGSPEAK_H |
mreda | 0:d98f92bb426f | 2 | #define MBED_THINGSPEAK_H |
mreda | 0:d98f92bb426f | 3 | |
mreda | 0:d98f92bb426f | 4 | #include "mbed.h" |
mreda | 0:d98f92bb426f | 5 | #include "HTTPClient.h" |
mreda | 0:d98f92bb426f | 6 | |
mreda | 0:d98f92bb426f | 7 | class Thingspeak { |
mreda | 0:d98f92bb426f | 8 | |
mreda | 0:d98f92bb426f | 9 | public: |
mreda | 0:d98f92bb426f | 10 | //This function post data to the thingspeak cloud |
mreda | 0:d98f92bb426f | 11 | /** Execute a POST request on the a private URL obtained from inputs' arguments |
mreda | 0:d98f92bb426f | 12 | Blocks until completion |
mreda | 0:d98f92bb426f | 13 | @param channelWriteAPIKey : your Channel Write API Key |
mreda | 0:d98f92bb426f | 14 | @param fieldNumber : field number of your channel |
mreda | 0:d98f92bb426f | 15 | @param fieldValue : field value of the entered field |
mreda | 0:d98f92bb426f | 16 | @return 0 on success, HTTP error (<0) on failure |
mreda | 0:d98f92bb426f | 17 | */ |
mreda | 0:d98f92bb426f | 18 | HTTPResult PostDataToChannel(char* channelWriteAPIKey, int fieldNumber, int fieldValue); |
mreda | 0:d98f92bb426f | 19 | |
mreda | 0:d98f92bb426f | 20 | |
mreda | 0:d98f92bb426f | 21 | private: |
mreda | 0:d98f92bb426f | 22 | HTTPClient _http; |
mreda | 0:d98f92bb426f | 23 | |
mreda | 0:d98f92bb426f | 24 | }; |
mreda | 0:d98f92bb426f | 25 | |
mreda | 0:d98f92bb426f | 26 | #endif |