//motor A connected between A01 and A02
#define STBY 10
#define PWMA 12 //pwm seem don't work
#define AIN1 9
#define AIN2 11
// variable to store current relay state
byte lastSetValue;
byte var1;
byte var2;
byte state;
byte change;
ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_BINARY(getter, setter));
// next macro sets up the sleeping mode
// device will wake up by user request and regulary listening for packets
//ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE);
// the setup routine runs once when you press reset:
void setup(){
pinMode(STBY, OUTPUT);
pinMode(PWMA, OUTPUT);
pinMode(AIN1, OUTPUT);
pinMode(AIN2, OUTPUT);
state=0;
change=0;
var1=0;
var2=0;
}
void loop(){
if (change == 1) {
if (state == 0) {
// Turn OFF
digitalWrite(STBY, HIGH); //disable standby
digitalWrite(AIN1, HIGH);
digitalWrite(AIN2, LOW);
//analogWrite(PWMA, 254);
digitalWrite(PWMA, HIGH);
//delay(150);
if (var1 > 200) {
var1=0;
var2=0;
digitalWrite(STBY, LOW); //enable standby
change=0;
// this function sends the device into sleep
//zunoSendDeviceToSleep();
}
var1++;
}
else
{
// Turn ON
digitalWrite(STBY, HIGH); //disable standby
digitalWrite(AIN1, LOW);
digitalWrite(AIN2, HIGH);
//analogWrite(PWMA, 254);
digitalWrite(PWMA, HIGH);
//delay(500); //go for 1 second
if (var2 > 200) {
var1=0;
var2=0;
digitalWrite(STBY, LOW); //enable standby
change=0;
// this function sends the device into sleep
//zunoSendDeviceToSleep();
}
var2++;
}
}
}
byte getter() {
return lastSetValue;
}
void setter(byte newValue) {
// newValue is a variable, holding a "value"
// which came from the controller or other Z-Wave device
if (newValue > 0) { // if greater then zero
state=1;
change=1;
}
else { // if equals zero
state=0;
change=1;
}
// save the new value in a variable
lastSetValue = newValue;
}
Unfortunatelly ZUNO_SWITCH_BINARY is not allowed in ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE mode due to Z-Wave certification. We are working with Z-Wave Alliance to officially allow it, meanwhile will add a parameter to disable this restriction.
Hello! This feature will become available in 2.0.7 - around mid/end of October. These weekends we will release 2.0.6
To upgrade you need to go to board manager, download updates (select newer version) and then use Burn bootloader menu item to upgrade your Z-Uno to the latest version
I went to board manager, but i didn't find any newer version in the option, it shows 0.6.7 as the last version. Should I change the URL of additional board manager? If so, can you please share the URL? thank you in advance.
PoltoS wrote:Hello! This feature will become available in 2.0.7 - around mid/end of October. These weekends we will release 2.0.6
To upgrade you need to go to board manager, download updates (select newer version) and then use Burn bootloader menu item to upgrade your Z-Uno to the latest version
Hi,
Is the feature to allow ZUNO_SWITCH_BINARY in ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE mode available already?
// LED pin number
// 13 pin - user LED of Z-Uno board
#define LED_PIN 13
// Last saved LED value
byte currentLEDValue;
ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_BINARY(getter, setter));
// next macro sets up the sleeping mode
// device will wake up by user request and regulary listening for packets
ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE);
// the setup routine runs once when you press reset:
void setup() {
pinMode(LED_PIN, OUTPUT); // setup pin as output
}
// the loop routine runs over and over again forever:
void loop() {
// this function sends the device into sleep
zunoSendDeviceToSleep();
}
void setter(byte value) {
// value is a variable, holding a "new value"
// which came from the controller or other Z-Wave device
if (value > 0) { // if greater then zero
digitalWrite (LED_PIN, HIGH); //turn the LED on (HIGH is the voltage level)
} else { // if equals zero
digitalWrite(LED_PIN, LOW); //turn the LED off by making the voltage LOW
}
// we'll save our value for the situation, when the controller will ask us about it
currentLEDValue = value;
}
byte getter() {
return currentLEDValue;
}