можно ли управлять 8 реле с z uno
Posted: 21 Jan 2017 16:08
Всем привет уменя вопрос можно прикрутить 8 реле к зуне .у меня получилось только 4 . я скопировал пример со светофором(https://geektimes.ru/company/zwave/blog/273588/)
/*
*
* 4 Relays controlled thouth resistors 220Omh and optocouplers 817С
* Off — HIGH
* On — LOW
*/
// Pins definitions
#define LedPin1 9
#define LedPin2 10
#define LedPin3 11
#define LedPin4 12
// Global variables to store data reported via getters
byte switchValue1 = 1;
byte switchValue2 = 1;
byte switchValue3 = 1;
byte switchValue4 = 1;
ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_ALWAYS_AWAKE);
// Set up 10 channels
ZUNO_SETUP_CHANNELS(
ZUNO_SWITCH_BINARY(getterSwitch1, setterSwitch1),
ZUNO_SWITCH_BINARY(getterSwitch2, setterSwitch2),
ZUNO_SWITCH_BINARY(getterSwitch3, setterSwitch3),
ZUNO_SWITCH_BINARY(getterSwitch4, setterSwitch4)
);
void setup() {
// set up I/O pins. Analog and PWM will be automatically set up on analogRead/analogWrite functions call
pinMode(LedPin1, OUTPUT);
pinMode(LedPin2, OUTPUT);
pinMode(LedPin3, OUTPUT);
pinMode(LedPin4, OUTPUT);
}
void loop() {
// Empty
}
// Getters and setters
void setterSwitch1(byte value) {
digitalWrite(LedPin1, (value > 0)? LOW: HIGH);
switchValue1 = value;
}
byte getterSwitch1(){
return switchValue1;
}
void setterSwitch2(byte value) {
digitalWrite(LedPin2, (value > 0)? LOW: HIGH);
switchValue2 = value;
}
byte getterSwitch2(){
return switchValue2;
}
void setterSwitch3(byte value) {
digitalWrite(LedPin3, (value > 0)? LOW: HIGH);
switchValue3 = value;
}
byte getterSwitch3(){
return switchValue3;
}
void setterSwitch4(byte value) {
digitalWrite(LedPin4, (value > 0)? LOW: HIGH);
switchValue4 = value;
}
byte getterSwitch4(){
return switchValue4;
}
, но когда попробовал увеличить количество swith binary получил ошибку компиляции
Arduino: 1.6.5 (Windows XP), Плата"Z-Wave>ME Z-Uno, Russian, Disabled, Disabled"
Изменена опция сборки, пересобираем все
Traceback (most recent call last):
File "C:\tmp\zuno-packager\build\zuno_toolchain-00.08.20-win32\build\compiler\out00-PYZ.pyz\logging", line 851, in emit
File "C:\tmp\zuno-packager\build\zuno_toolchain-00.08.20-win32\build\compiler\out00-PYZ.pyz\logging", line 724, in format
File "C:\tmp\zuno-packager\build\zuno_toolchain-00.08.20-win32\build\compiler\out00-PYZ.pyz\logging", line 467, in format
UnicodeDecodeError: 'ascii' codec can't decode byte 0xae in position 226: ordinal not in range(128)
Logged from file logging, line 1620
************* Building Arduino Sketch *************
C:\Users\29F0~1\AppData\Local\Temp\build6936783508414762416.tmp/_4_kanala.cpp
***************************************************
Preprocessing file: Print.cpp with SDCPP...
Compiling Print_sdcpp_.cpp ...
Preprocessing file: Stream.cpp with SDCPP...
Compiling Stream_sdcpp_.cpp ...
Preprocessing file: HardwareSerial.cpp with SDCPP...
Compiling HardwareSerial_sdcpp_.cpp ...
Preprocessing file: HLCore.cpp with SDCPP...
Compiling HLCore_sdcpp_.cpp ...
Preprocessing file: __4_kanala.cpp with SDCPP...
Compiling __4_kanala_sdcpp_.cpp ...
Preprocessing file: Print.cpp with SDCPP...
Compiling Print_sdcpp_.cpp ...
Preprocessing file: Stream.cpp with SDCPP...
Compiling Stream_sdcpp_.cpp ...
Preprocessing file: HardwareSerial.cpp with SDCPP...
Compiling HardwareSerial_sdcpp_.cpp ...
Preprocessing file: HLCore.cpp with SDCPP...
Compiling HLCore_sdcpp_.cpp ...
Preprocessing file: __4_kanala.cpp with SDCPP...
Compiling __4_kanala_sdcpp_.cpp ...Compiling file "LLCore_arduino.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\52A8~1\AppData\Roaming\ARDUIN~1\packages\Z-Uno\tools\ZUNO_T~1\0008~1.20\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\52A8~1\AppData\Roaming\ARDUIN~1\packages\Z-Uno\tools\ZUNO_T~1\0008~1.20\ZUNO_T~1/sdcc/\bin\..\include" "LLCore_arduino.c"
sdcc: Generating code...
LLCore_arduino.c:25: warning 85: in function NOPS unreferenced function argument : 'i'
LLCore_arduino.c:218: warning 85: in function delayLoops unreferenced function argument : 'v'
/Custom.h:13: error 20: Undefined identifier 'getterSwitch5'
/Custom.h:13: error 20: Undefined identifier 'setterSwitch5'
Error. SDCC returned: 1
Ошибка компиляции.
Это сообщение будет содержать больше информации чем
"Отображать вывод во время компиляции"
включено в Файл > Настройки
я так понял больше 4 реле не получится?
/*
*
* 4 Relays controlled thouth resistors 220Omh and optocouplers 817С
* Off — HIGH
* On — LOW
*/
// Pins definitions
#define LedPin1 9
#define LedPin2 10
#define LedPin3 11
#define LedPin4 12
// Global variables to store data reported via getters
byte switchValue1 = 1;
byte switchValue2 = 1;
byte switchValue3 = 1;
byte switchValue4 = 1;
ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_ALWAYS_AWAKE);
// Set up 10 channels
ZUNO_SETUP_CHANNELS(
ZUNO_SWITCH_BINARY(getterSwitch1, setterSwitch1),
ZUNO_SWITCH_BINARY(getterSwitch2, setterSwitch2),
ZUNO_SWITCH_BINARY(getterSwitch3, setterSwitch3),
ZUNO_SWITCH_BINARY(getterSwitch4, setterSwitch4)
);
void setup() {
// set up I/O pins. Analog and PWM will be automatically set up on analogRead/analogWrite functions call
pinMode(LedPin1, OUTPUT);
pinMode(LedPin2, OUTPUT);
pinMode(LedPin3, OUTPUT);
pinMode(LedPin4, OUTPUT);
}
void loop() {
// Empty
}
// Getters and setters
void setterSwitch1(byte value) {
digitalWrite(LedPin1, (value > 0)? LOW: HIGH);
switchValue1 = value;
}
byte getterSwitch1(){
return switchValue1;
}
void setterSwitch2(byte value) {
digitalWrite(LedPin2, (value > 0)? LOW: HIGH);
switchValue2 = value;
}
byte getterSwitch2(){
return switchValue2;
}
void setterSwitch3(byte value) {
digitalWrite(LedPin3, (value > 0)? LOW: HIGH);
switchValue3 = value;
}
byte getterSwitch3(){
return switchValue3;
}
void setterSwitch4(byte value) {
digitalWrite(LedPin4, (value > 0)? LOW: HIGH);
switchValue4 = value;
}
byte getterSwitch4(){
return switchValue4;
}
, но когда попробовал увеличить количество swith binary получил ошибку компиляции
Arduino: 1.6.5 (Windows XP), Плата"Z-Wave>ME Z-Uno, Russian, Disabled, Disabled"
Изменена опция сборки, пересобираем все
Traceback (most recent call last):
File "C:\tmp\zuno-packager\build\zuno_toolchain-00.08.20-win32\build\compiler\out00-PYZ.pyz\logging", line 851, in emit
File "C:\tmp\zuno-packager\build\zuno_toolchain-00.08.20-win32\build\compiler\out00-PYZ.pyz\logging", line 724, in format
File "C:\tmp\zuno-packager\build\zuno_toolchain-00.08.20-win32\build\compiler\out00-PYZ.pyz\logging", line 467, in format
UnicodeDecodeError: 'ascii' codec can't decode byte 0xae in position 226: ordinal not in range(128)
Logged from file logging, line 1620
************* Building Arduino Sketch *************
C:\Users\29F0~1\AppData\Local\Temp\build6936783508414762416.tmp/_4_kanala.cpp
***************************************************
Preprocessing file: Print.cpp with SDCPP...
Compiling Print_sdcpp_.cpp ...
Preprocessing file: Stream.cpp with SDCPP...
Compiling Stream_sdcpp_.cpp ...
Preprocessing file: HardwareSerial.cpp with SDCPP...
Compiling HardwareSerial_sdcpp_.cpp ...
Preprocessing file: HLCore.cpp with SDCPP...
Compiling HLCore_sdcpp_.cpp ...
Preprocessing file: __4_kanala.cpp with SDCPP...
Compiling __4_kanala_sdcpp_.cpp ...
Preprocessing file: Print.cpp with SDCPP...
Compiling Print_sdcpp_.cpp ...
Preprocessing file: Stream.cpp with SDCPP...
Compiling Stream_sdcpp_.cpp ...
Preprocessing file: HardwareSerial.cpp with SDCPP...
Compiling HardwareSerial_sdcpp_.cpp ...
Preprocessing file: HLCore.cpp with SDCPP...
Compiling HLCore_sdcpp_.cpp ...
Preprocessing file: __4_kanala.cpp with SDCPP...
Compiling __4_kanala_sdcpp_.cpp ...Compiling file "LLCore_arduino.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\52A8~1\AppData\Roaming\ARDUIN~1\packages\Z-Uno\tools\ZUNO_T~1\0008~1.20\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\52A8~1\AppData\Roaming\ARDUIN~1\packages\Z-Uno\tools\ZUNO_T~1\0008~1.20\ZUNO_T~1/sdcc/\bin\..\include" "LLCore_arduino.c"
sdcc: Generating code...
LLCore_arduino.c:25: warning 85: in function NOPS unreferenced function argument : 'i'
LLCore_arduino.c:218: warning 85: in function delayLoops unreferenced function argument : 'v'
/Custom.h:13: error 20: Undefined identifier 'getterSwitch5'
/Custom.h:13: error 20: Undefined identifier 'setterSwitch5'
Error. SDCC returned: 1
Ошибка компиляции.
Это сообщение будет содержать больше информации чем
"Отображать вывод во время компиляции"
включено в Файл > Настройки
я так понял больше 4 реле не получится?