Sensors not seen
Posted: 01 Oct 2020 19:04
Hi,
I uploaded an official sketch to a Z-uno Shiled, with 4 sensors on ADC0-3:
After added to Fibaro HC2 only a motion sensor is visible, it is in ADC0. Where is the other sensors?
I uploaded an official sketch to a Z-uno Shiled, with 4 sensors on ADC0-3:
Code: Select all
// Global variables
byte pin3SensorBinaryState;
byte pin4SensorBinaryState;
byte pin5SensorBinaryState;
byte pin6SensorBinaryState;
// Z-Wave channels
ZUNO_SETUP_CHANNELS(
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, pin3SensorBinaryGetter),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_WATER, pin4SensorBinaryGetter),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_MOTION, pin5SensorBinaryGetter),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_DOOR_WINDOW, pin6SensorBinaryGetter)
);
void setup() {
pinMode(3, INPUT);
pin3SensorBinaryState = !digitalRead(3);
pinMode(4, INPUT);
pin4SensorBinaryState = !digitalRead(4);
pinMode(5, INPUT);
pin5SensorBinaryState = !digitalRead(5);
pinMode(6, INPUT);
pin6SensorBinaryState = !digitalRead(6);
}
void loop() {
byte _pin3SensorBinaryState = digitalRead(3);
if (pin3SensorBinaryState != _pin3SensorBinaryState) {
pin3SensorBinaryState = _pin3SensorBinaryState;
zunoSendReport(1);
}
byte _pin4SensorBinaryState = digitalRead(4);
if (pin4SensorBinaryState != _pin4SensorBinaryState) {
pin4SensorBinaryState = _pin4SensorBinaryState;
zunoSendReport(2);
}
byte _pin5SensorBinaryState = digitalRead(5);
if (pin5SensorBinaryState != _pin5SensorBinaryState) {
pin5SensorBinaryState = _pin5SensorBinaryState;
zunoSendReport(3);
}
byte _pin6SensorBinaryState = digitalRead(6);
if (pin6SensorBinaryState != _pin6SensorBinaryState) {
pin6SensorBinaryState = _pin6SensorBinaryState;
zunoSendReport(4);
}
delay(20);
}
// Getters and setters
byte pin3SensorBinaryGetter() {
return pin3SensorBinaryState;
}
byte pin4SensorBinaryGetter() {
return pin4SensorBinaryState;
}
byte pin5SensorBinaryGetter() {
return pin5SensorBinaryState;
}
byte pin6SensorBinaryGetter() {
return pin6SensorBinaryState;
}