rc-switch icon indicating copy to clipboard operation
rc-switch copied to clipboard

Problem with recieved value

Open bhasim1 opened this issue 1 year ago • 1 comments

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 avatar Apr 04 '23 20:04 bhasim1