Installation
-
You can search for Grandeur in Arduino's library manager. In Arduino IDE, open
Sketch > Include Library > Manage Libraries
and install Grandeur from there. -
You can also download the latest release of Arduino SDK from here (opens in a new tab) and install it in your Arduino IDE.
This is how you can include Grandeur
in your Arduino sketch:
#include <Grandeur.h>
When you include <Grandeur.h>
in your sketch, a global object grandeur is created right away which you can use to give the SDK your project's API Key and your device access token so it can start connecting with Grandeur.
Var json; // The root
json["foo"] = "This is foo"; // "foo" key in json
json["bar"] = true; // "bar" key in json
json["foobar"]["foo"] = "This is foo inside foobar"; // "foo" key in "foobar" key in json
// In JSON, json would look like:
// {
// "foo": "This is foo",
// "bar": true,
// "foobar": {
// "foo": "This is foo inside foobar"
// }
// }
// You can also store anything in Var.
Var x = 5;
x = "hello";
Serial.println(x); // Prints: hello
An example is as below
#include <Grandeur.h>
Grandeur::Project project;
void setup() {
// You can initialize device configurations like this.
project = grandeur.init(apiKey, token);
}
void loop() { project.loop(WiFiState == CONNECTED); // Same as "if(WiFiState == CONNECTED) project.loop();"}