sui77 / rc-switch

Arduino lib to operate 433/315Mhz devices like power outlet sockets.
1.94k stars 662 forks source link

Small contribution #492

Open Condiolov opened 1 year ago

Condiolov commented 1 year ago

First congratulations for the beautiful work here!! Basic and advanced level well documented!! I was frustrated for not being able to do it on the first try, I even read the advanced part but I saw that it goes way beyond my capabilities!! In short, I used the ReceiveDemo_Advanced.ino code to capture the information. But when sending the binary nothing happened, I even took the board close to the receiver and nothing! But at least the received codes were solid and coherent!! Searching through google in some forum I saw the following code that varies the protocols 1,2, (...) when doing this I noticed that even from a distance the receiver made a beep (when you press the beep control) I tried the protocol in which it beeped and anything!! then I did the same for the wrist and for the repetitions, and it worked!! Despite detecting a pulse of 426, the sending is 355, I don't know if it's because of the distance, or because of the hardware I'm running. In the end, the important thing is that it worked perfectly!! Thank you very much!! Below the code just go uncommenting the tests..

`/ Based on the SendDemo example from the RC Switch library https://github.com/sui77/rc-switch/ /

include

RCSwitch mySwitch = RCSwitch();

void setup() { Serial.begin(9600); // Transmitter is connected to Arduino Pin #10 mySwitch.enableTransmit(10);

// Optional set pulse length. //mySwitch.setPulseLength(426); // 426 read in code ReceiveDemo_Advanced.ino FAIL

// Optional set protocol (default is 1, will work for most outlets) // mySwitch.setProtocol(1); // 1 read in code ReceiveDemo_Advanced.ino OK

// Optional set number of transmission repetitions. // mySwitch.setRepeatTransmit(30); // TEST TEST } int i = 1;

void loop() { i = i + 1; // 1º TEST PROTOCOL mySwitch.setProtocol(i);

// 2º TEST PULSE //mySwitch.setPulseLength(i);

// 3º TEST REPEAT //mySwitch.setRepeatTransmit(i);

mySwitch.send("001100111110011100000011"); // My BINARY read in code ReceiveDemo_Advanced.ino OK

Serial.print(i); // PRINT i Serial.print("-");

}`