Control arduino using 433mhz remote

Hello, I've got a 433mhz remote (came with a pack of sockets) and want to use it to control my arduino with it. In this case, I want the arduino to control a relay, if I press a button on the remote. My receiver module is the xy-mk-5v .

I've been fiddling with the rcswitch library ( ) and found out what information the remote is transmitting when I press the button.

Decimal: 1361 (24Bit) Binary: 000000000000010101010001 Tri-State: 000000FFFF0F PulseLength: 353 microseconds Protocol: 1

I just don't know how to write a sketch that receives the data and uses it to control something(although I know how to use the relay with buttons or timers).

Preferably I want to use the transmitted Tri-State value as a trigger. I guess I have to use

void loop() { * if (mySwitch.available()) {*

could anyone give me a hand with this? Thanks!

Start with the simple receive demo. Create a class: RCSwitch mySwitch = RCSwitch(); Set interrupt pin for receicing in setup(): mySwitch.enableReceive(0); In the loop() you get the value. You don't need to do more.

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

  switch (value)
    case 1361:
      Serial.println(F("Button pressed"));