Somehow the client installed a smart home: the task was to unite all the consoles into one and the phone became this remote. There were three remotes, two of them were with an infrared signal, but the third - from the curtains - turned out to be on a radio signal. I can record and transmit a signal with the help of a ztx-120 device, but you cannot record a radio signal. What to do in this case, I want to tell in this article. Only in the example there will be not a radio control, but a cell phone, the meaning will not change./* * That is a Simple Sensor Multilevel example * It measures the value on the potentiometer * And sends report to the controller if changed */ // LED pin number #define LED_PIN 13 #define LED_PINN 14 #define LED_PINNN 15 // Last saved LED value byte currentLEDValue; byte currentLEDValuee; byte currentLEDValueee; // next macro sets up the Z-Uno channels // in this example we set up 1 switch binary channel // you can read more on http://z-uno.z-wave.me/Reference/ZUNO_SWITCH_BINARY/ ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_BINARY(getter, setter), ZUNO_SWITCH_BINARY(getterr, setterr), ZUNO_SWITCH_BINARY(getterrr, setterrr)); // next macro sets up the Z-Uno frequency ZUNO_SETUP_FREQUENCY(ZUNO_FREQ_RU); void setup() { pinMode(LED_PIN, OUTPUT); // setup pin as output pinMode(LED_PINN, OUTPUT); // setup pin as output pinMode(LED_PINNN, OUTPUT); // setup pin as output } void loop() { // loop is empty, because all the control comes over the Z-Wave } // function, which sets new relay state // this function runs only once the controller sends new value 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 LED on } else { // if equals zero digitalWrite(LED_PIN, LOW); //turn LED off } // let's save our value for the situation, when the controller will ask us about it currentLEDValue = value; } void setterr (byte valuee) { // value is a variable, holding a "new value" // which came from the controller or other Z-Wave device if (valuee > 0) { // if greater then zero digitalWrite (LED_PINN, HIGH); //turn LED on } else { // if equals zero digitalWrite(LED_PINN, LOW); //turn LED off } // let's save our value for the situation, when the controller will ask us about it currentLEDValuee = valuee; } void setterrr (byte valueee) { // value is a variable, holding a "new value" // which came from the controller or other Z-Wave device if (valueee > 0) { // if greater then zero digitalWrite (LED_PINNN, HIGH); //turn LED on } else { // if equals zero digitalWrite(LED_PINNN, LOW); //turn LED off } // let's save our value for the situation, when the controller will ask us about it currentLEDValueee = valueee; } // function, which returns the previously saved relay value // this function runs only once the controller asks byte getter (){ return currentLEDValue; } byte getterr (){ return currentLEDValuee; } byte getterrr (){ return currentLEDValueee; }
At the time of this writing, I didn’t have a remote at hand, but for example, I took my old cell phone with buttons, disassembled and soldered to the “one”, “two” and “reset” buttons. Then I decided to take all the “ground” from the phone buttons and twist it into one, and scattered the pluses on the pins 13,14,15.



Source: https://habr.com/ru/post/395907/
All Articles