References
.data()
.get()

data.get

This method gets a device variable from Grandeur.

Parameters

NameTypeDescription
callbackcallbackA function to be called when get response is received.
pathStringPath of the device variable using dot notation.
Grandeur::Project project;
Grandeur::Project::Device device;
 
void getVoltageCallback(const char* code, int voltage) { // You can write any type int/double/bool/const char* in place of Var and it'll cast voltage to that type.
  // This method prints *voltage* variable from device data.
  Serial.println(voltage);
}
 
void setup() {
  project = grandeur.init(ApiKey, YourToken);
  device = project.device(deviceID);
}
 
void loop() {
  // This requests to get "voltage" variable from device data on every loop and calls getVoltageCallback() function when the
  // data from Grandeur actually arrives.
  device.data().get("voltage", getVoltageCallback);
 
  if(WiFiIsConnected) project.loop();
}