I would like to implement an FLiRS Device with new 2.1.5 release and the dynamic channel asignement. I havethe following code:
Code: Select all
#include <ZUNO_BMP280.h>
#include "Wire.h"
ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE);
ZUNO_ENABLE(LOGGING_EVENTS LOGGING_UART=Serial WITH_CC_SENSOR_MULTILEVEL WITH_CC_BATTERY);
ZUNO_DYNAMIC_CHANNELS(3);
#define MY_SCL_PIN 10
#define MY_SDA_PIN 9
#define MAP_TO_ZEROCHANNEL 0x80
ZUNO_BMP280 Senesor;
I2CDriver alternative_I2C(MY_SCL_PIN, MY_SDA_PIN);
boolean initDone = false;
void setup()
{
ZUNO_START_CONFIG();
ZUNO_SET_ZWCHANNEL(1| MAP_TO_ZEROCHANNEL); // <- this channel will be provided via 1 & 0 channels
ZUNO_ADD_CHANNEL(ZUNO_SENSOR_MULTILEVEL_CHANNEL_NUMBER, ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, SENSOR_MULTILEVEL_PROPERTIES_COMBINER( SENSOR_MULTILEVEL_SCALE_CELSIUS, SENSOR_MULTILEVEL_SIZE_FOUR_BYTES, SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS));
ZUNO_SET_ZWCHANNEL(2);
ZUNO_ADD_CHANNEL(ZUNO_SENSOR_MULTILEVEL_CHANNEL_NUMBER, ZUNO_SENSOR_MULTILEVEL_TYPE_RELATIVE_HUMIDITY, SENSOR_MULTILEVEL_PROPERTIES_COMBINER( SENSOR_MULTILEVEL_SCALE_PERCENTAGE_VALUE, SENSOR_MULTILEVEL_SIZE_FOUR_BYTES, SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS));
ZUNO_SET_ZWCHANNEL(3);
ZUNO_ADD_CHANNEL(ZUNO_SENSOR_MULTILEVEL_CHANNEL_NUMBER, ZUNO_SENSOR_MULTILEVEL_TYPE_BAROMETRIC_PRESSURE, SENSOR_MULTILEVEL_PROPERTIES_COMBINER( SENSOR_MULTILEVEL_SCALE_KILO_PASCAL, SENSOR_MULTILEVEL_SIZE_FOUR_BYTES, SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS));
ZUNO_COMMIT_CONFIG();
Wire.bindDriver(&alternative_I2C);
Wire.begin();
initDone = Senesor.begin();
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
{
delay(5000);
digitalWrite(13, HIGH);
delay(2000);
digitalWrite(13, LOW);
if (!initDone)
{
g_channels_data[0].dwParam = 2500;
g_channels_data[1].dwParam = 5300;
g_channels_data[2].dwParam = 95000;
}
else
{
g_channels_data[0].dwParam = Senesor.readTemperatureC100();
g_channels_data[1].dwParam = Senesor.readPressurePa();
g_channels_data[2].dwParam = Senesor.readHumidityH10();
}
zunoSendReport(1);
zunoSendReport(2);
zunoSendReport(3);
zunoSetBeamCountWU(10);
zunoSendDeviceToSleep();
}
Thank you