Include konker.h to work with this library.
Declare KonkerDevice object:
KonkerDevice device;
Initialize konker lib at setup()
, there are several possible configurations to be changed:
device.addWifi()
device.setServer()
device.setPlatformCredentials()
device.setDefaultConnectionType()
Inialize WiFi connection and connection to platform:
device.init()
Example:
void setup(){
Serial.println("Setup");
device.addWifi("ssid", "password");
device.setDefaultConnectionType(ConnectionType::MQTT);
device.setServer("prod.konkerlabs.net", 1883);
device.init();
Serial.println("Setup finished");
}
After the setup in the main loop()
put:
device.loop();
Example:
void loop(){
device.loop();
}
Data collected is stored in a buffer, from where it is sent to the platform.
Example:
// message is a json formatted string
device.storeData("pub_channel", message);
device.sendData();
TODO
Updates checks are done automatically inside the KonkerDevice::loop()
function. It is not checked every loop, the interval should be set accordingly.