sui77 / rc-switch

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

Problem with recieved value #485

Open bhasim1 opened 1 year ago

bhasim1 commented 1 year ago

my arduino code:



RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(0);
}

void loop() {
  if (mySwitch.available()) 
  {
    int value = mySwitch.getReceivedValue();

    if (value == 0) 
    {
      Serial.println("Unbekannter Code");
    }

    else 
    {
      Serial.print("Empfangen: ");
      Serial.println(mySwitch.getReceivedValue());
    }

    mySwitch.resetAvailable(); 
  }
}```

So I want to turn that number into the command that was sent.
For that I wrote a function which works pretty well, but I have to add a 0 in front of it (which works if I don't have a "sGroup" with a 1 in the front) else I have an uneven number of bits and I don't know why.
From what I can tell, the "sendTriState" function should return an even number of bits.
bhasim1 commented 1 year ago

https://arduino.stackexchange.com/questions/79314/rc-switch-library-display-received-values-only-one-times-using-serial-monitor

If you at the send value „010101010101010100000011“ isn‘t equal to the ecpected dec value „5592323“ in bin. so they account for the wrong send value