Hi,
i bought my zuno like 4 years ago i reckon and never did anything with it.
Ive decided to break it out and would like to build on the 4 power relay example.
Basically i want to have 4 momentary switches as inputs to manually turn the relays on and off.
Id also like to add a temperature and humidity sensor...
End use is the heat lamps x2, fan and light in the bathroom with a humidity sensor to auto start the fan...
four power relay example
-
- Posts: 16
- Joined: 16 Oct 2018 05:00
- Location: Gold Coast, QLD, Australia
- Contact:
Re: four power relay example
All that is possible. How can the community help you?
-
- Posts: 16
- Joined: 16 Oct 2018 05:00
- Location: Gold Coast, QLD, Australia
- Contact:
Re: four power relay example
Hi PoltoS,
I guess im struggling with mashing together the programming. I butchered the 4 relay example and then tried to add external switches into the mix, but i just couldnt get it to compile and i dont know what the errors mean.
This is my code (It wouldnt let my upload the ino file?)
Code: Select all
// Global variables
byte buttonState1;
byte buttonState2;
byte buttonState3;
byte buttonState4;
byte switchValue1 = 0;
byte switchValue2 = 0;
byte switchValue3 = 0;
byte switchValue4 = 0;
// Z-Wave channels
ZUNO_SETUP_CHANNELS(
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getterButton1),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getterButton2),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getterButton3),
ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getterButton4),
ZUNO_SWITCH_BINARY(getterSwitch1, setterSwitch1),
ZUNO_SWITCH_BINARY(getterSwitch2, setterSwitch2),
ZUNO_SWITCH_BINARY(getterSwitch3, setterSwitch3),
ZUNO_SWITCH_BINARY(getterSwitch4, setterSwitch4)
);
void setup() {
pinMode(19, INPUT);
buttonState1 = !digitalRead(3);
pinMode(20, INPUT);
buttonState2 = !digitalRead(4);
pinMode(21, INPUT);
buttonState3 = !digitalRead(5);
pinMode(22, INPUT);
buttonState4 = !digitalRead(6);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
byte _buttonState1 = digitalRead(19);
if (buttonState1 != _buttonState1) {
buttonState1 = _buttonState1;
zunoSendReport(1);
}
byte _buttonState2 = digitalRead(20);
if (buttonState2 != _buttonState2) {
buttonState2 = _buttonState2;
zunoSendReport(2);
}
byte _buttonState3 = digitalRead(21);
if (buttonState3 != _buttonState3) {
buttonState3 = _buttonState3;
zunoSendReport(3);
}
byte _buttonState4 = digitalRead(22);
if (buttonState4 != _buttonState4) {
buttonState4 = _buttonState4;
zunoSendReport(4);
}
digitalWrite(9, switchValue1 ? HIGH : LOW);
digitalWrite(10, switchValue2 ? HIGH : LOW);
digitalWrite(11, switchValue3 ? HIGH : LOW);
digitalWrite(12, switchValue4 ? HIGH : LOW);
delay(20);
}
// Getters and setters
byte getterButton1() {
return buttonState1;
}
byte getterButton2() {
return buttonState2;
}
byte getterButton3() {
return buttonState3;
}
byte getterButton4() {
return buttonState4;
}
void setterSwitch1(byte value) {
switchValue1 = value;
}
byte getterSwitch1() {
return switchValue1;
}
void setterSwitch2(byte value) {
switchValue2 = value;
}
byte getterSwitch2() {
return switchValue2;
}
void setterSwitch3(byte value) {
switchValue3 = value;
}
byte getterSwitch3() {
return switchValue3;
}
void setterSwitch4(byte value) {
switchValue4 = value;
}
byte getterSwitch4() {
return switchValue4;
}
I have nil experience using this... which im sure will be plainly obvious...
************* Building Arduino Sketch *************
C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6/4 way relay with switch input zuno.ino
***************************************************
--- USING a list of libraries from:
C:\Users\doini\AppData\Local\Arduino15\packages\Z-Uno\hardware\zw8051\2.1.8\libraries
c:\Users\doini\OneDrive\Documents\Arduino\libraries
*** Collecting prototypes...
Preprocessing file: C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\Custom.c with SDCPP...
Preprocessing file: C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\Print.cpp with SDCPP...
Compiling C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\Print_sdcpp_.cpp ...
Print_sdcpp_.cpp:543:17& has lower precedence than ==; == will be evaluated first
Preprocessing file: C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\Stream.cpp with SDCPP...
Compiling C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\Stream_sdcpp_.cpp ...
Preprocessing file: C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\HardwareSerial.cpp with SDCPP...
Compiling C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\HardwareSerial_sdcpp_.cpp ...
Preprocessing file: C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\HLCore.cpp with SDCPP...
Compiling C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\HLCore_sdcpp_.cpp ...
Preprocessing file: C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\EEPROM.cpp with SDCPP...
Compiling C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\EEPROM_sdcpp_.cpp ...
Preprocessing file: C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\4 way relay with switch input zuno.cpp with SDCPP...
Compiling C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\4 way relay with switch input zuno_sdcpp_.cpp ...
Preprocessing file: C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\ZWSupport.cpp with SDCPP...
Compiling C:\Users\doini\AppData\Local\Temp\arduino-sketch-203E8FD2854AA30CD0673EE4D64A6EF6\ZWSupport_sdcpp_.cpp ...
ZWSupport_sdcpp_.cpp6:error:variable has incomplete type 'void'
ZWSupport_sdcpp_.cpp22:error:expected ';' after top level declarator
uCxx returned error code:1
exit status 1
Compilation error: exit status 1
Thanks for any and all help.
Josh
-
- Posts: 16
- Joined: 16 Oct 2018 05:00
- Location: Gold Coast, QLD, Australia
- Contact:
Re: four power relay example
Can anyone help me with this one???
Re: four power relay example
Hi!
Please update to 3.0.13 and test. If it still does not work, please show the full sketch
Please update to 3.0.13 and test. If it still does not work, please show the full sketch