sui77 / rc-switch

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

Using sample programs to receive and send codes - Pulselength displayed on Receive does not work on Send #356

Open davidkjackson54 opened 4 years ago

davidkjackson54 commented 4 years ago

I am using the example ReceiveDemo_Simple and SendDemo. I added a line to ReceieveDemo_Simple to display the Pulse Length.
When I run it it gives: Received 5506355 / 24bit Protocol: 1 / Delay: 185 microseconds Received 5506355 / 24bit Protocol: 1 / Delay: 185 microseconds Received 5506355 / 24bit Protocol: 1 / Delay: 185 microseconds Received 5506355 / 24bit Protocol: 1 / Delay: 186 microseconds

I then looked at the SendDemo and it does not specify either Protocol or Pulselength. I believe that it defaults to Protocol of 1 and Pulselength of 200. However it works as standard with the defaults. I made a small change to set the Protocol to 1 and the Pulselength to 185 - I got these from the ReceveDemo displayed above. i.e. I set this: mySwitch.setProtocol(1,185);

The code does NOT now turn on or off the plug.
I changed the value from 185 up through to 194 and it still didn't work. at 195 it started to work. mySwitch.setProtocol(1,195); I then bumped it up 1 at a time up through 224 at which point it stopped working again.

So my questions are: 1) why would the ReceiveDemo report a Pulselength of 185 and why doesn't that same value not then work in the SendDemo? 2) Should I ignore setting Pulselength entirely and simply let it default? Or is that asking for trouble? 3) Does the Pulselength default vary based on the Protocol? in other works if I get a different Protocol value back from the ReceiveDemo should I set that Protocol value correctly on the Send but not touch the PulseLength?

Sorry if these are dumb questions.

davidkjackson54 commented 4 years ago

I made a change to the board to switch the Receiver to get 5v input instead of 3.3v and that seems to have helped resolve this issue. I can now turn on and off the plug with the pulselength set at 185 as given back by the ReceiveTestDemo. I am using a setRepeatTransmit of 15 - just to be on the safe side.

Not being a hardware guy - do the symptoms that I mentioned suggest that a 3,3v input may likely have been the issue? Or is it working just a fluke.