-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce6340f
commit 8c9af51
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
examples/reportMultipleDataType/reportMultipleDataType.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Example for report multiple type data to Magellan IoT Platform | ||
please use payload with json format e.g. {"Temperature":25.5,"Humidity":90.4,"Light":45} | ||
and {"Location":"13.001,100.44"} for plot the location on MAP | ||
| | | ||
latitude longitude | ||
and {"Lamp":0} or {"Lamp":1"} for show the Lamp status on dashboard | ||
Please login and enjoy with https://magellan.ais.co.th | ||
If you have any questions, please see more details at https://magellan.ais.co.th | ||
*/ | ||
#include "Magellan_BC95_lite.h" | ||
Magellan_BC95_lite magel; | ||
|
||
String payload; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
magel.begin(); //Init Magellan LIB | ||
} | ||
|
||
void loop() | ||
{ | ||
//Positive Number Type | ||
unsigned int Positive_Number = 1234; | ||
payload ="{\"Positive_Number\":"+String(Positive_Number)+"}"; | ||
magel.report(payload); //Report data positive number type | ||
delay(5000); //Delay 5 second | ||
|
||
//Negative Number Type | ||
int Negative_Number = -1234; | ||
payload ="{\"Negative_Number\":"+String(Negative_Number)+"}"; | ||
magel.report(payload); //Report data negative number type | ||
delay(5000); //Delay 5 second | ||
|
||
//Floating Point Number Type | ||
float Floating_Point_Number = 12.34; | ||
payload ="{\"Floating_Point_Number\":"+String(Floating_Point_Number)+"}"; | ||
magel.report(payload); //Report data decimal number type | ||
delay(5000); //Delay 5 second | ||
|
||
//Text Type | ||
String Text = "\"Hello World\""; | ||
payload ="{\"Text\":"+String(Text)+"}"; | ||
magel.report(payload); //Report data text type | ||
delay(5000); //Delay 5 second | ||
|
||
//Location Type | ||
String Location = "\"13.764980,100.538335\""; | ||
payload ="{\"Location\":"+String(Location)+"}"; | ||
magel.report(payload); //Report data location type | ||
delay(5000); //Delay 5 second | ||
|
||
//Boolean Type | ||
bool Boolean = 1; | ||
payload ="{\"Boolean\":"+String(Boolean)+"}"; | ||
magel.report(payload); //Report data boolean type | ||
delay(5000); //Delay 5 second | ||
} |