Default pin 433Mhz RF link kit

Hello,
I want to know how to change the digital pin by default from the receiver because I want to put an interruption but the default pin is 11 but I have a mega 2560 Arduino card and only pin 2,3,18,19,20 and 21 are allowed. The digital pin 2 is already taken by a zero crossing detector. I saw in the documentation this line code:
Capture

and I found it in the virtualwire.h doc but I use radiohead. Please help me :pray: :sob:

Could you please tell me the source of the document you used? If you can send a copy of your test code, this will allow me to quickly define the issue for you. @alexandre1

Hello @Baozhu! I used this source document avaible on the the 433MHz RF kit (on the page 5):

So I used this code with the RadioHead Library:

#include <RH_ASK.h>    
RH_ASK driver;

void setup()
{   
    initialisation_interruption ();
    pinMode(2, INPUT);
    digitalWrite(2, HIGH);
    pinMode(13, OUTPUT);
    digitalWrite(13, LOW);

    #ifdef RH_HAVE_SERIAL
     Serial.begin(9600);	  
    #endif
     if (!driver.init())
      #ifdef RH_HAVE_SERIAL
        Serial.println("init failed");
    #endif
}

void loop()
{ 
 delay (5000);
}

void initialisation_interruption ()
{
  attachInterrupt(digitalPinToInterrupt(2), led, CHANGE);
    attachInterrupt(digitalPinToInterrupt(11), remote, CHANGE);
}

void led ()
{
        if (digitalRead(2))   
   {
    digitalWrite(13, LOW);
   }  
     else if (!digitalRead(2)) 
      { 
       digitalWrite(13, HIGH);
      } 
}

void remote ()
{
  uint8_t buf[4]; 
  uint8_t buflen = sizeof(buf); 
    if (driver.recv(buf, &buflen))
     { 
        int i;
         Serial.print("Bouton: "); 
         Serial.println((char*)buf); 
     }
}


And this code with virtual wire: 

#include <VirtualWire.h>

void setup()
{   
    pinMode(2, INPUT);
    digitalWrite(2, HIGH);
    pinMode(13, OUTPUT);
    digitalWrite(13, LOW);

    Serial.begin(9600);  
    vw_set_rx_pin(3);
    vw_setup(2000); 
    vw_rx_start(); 

    attachInterrupt(digitalPinToInterrupt(2), led, CHANGE);
    attachInterrupt(digitalPinToInterrupt(3), remote, CHANGE);
}

void loop()
{ 
  delay (5000);
}

void led ()
{
    if (digitalRead(2))   
   {
     digitalWrite(13, LOW);
   }  
      else if (!digitalRead(2)) 
      { 
       digitalWrite(13, HIGH);
      } 
}

void remote ()
{
    uint8_t buf[4];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen))
    {
  int i;
  
  Serial.print("Bouton: ");
  
  for (i = 0; i < buflen; i++)
  {
      Serial.print(buf[i], HEX);
      Serial.print(" ");
  }
  Serial.println("");
        digitalWrite(13, false);
    }
}

So I need to change the default pin because I need to interrupt my program, I succeeded with this line on Virtual Wire: vw_set_rx_pin(3); but the display looks like this :
Capture

Instead of:
Bouton: A
Bouton: B
Bouton: C

Edit: It seems that the lign code to change rx pin is:
RH_ASK driver(2000,3,12,10,false);
or
RH_ASK driver(2000,3);

But it didn’t work :sob: :confused:

Hey @Baozhu! I finally achieve !! I’ve put this line in the setup when it had to be put before :laughing:
so this is my code! :

#include <RH_ASK.h>
#include <SPI.h>
 
#define buffsize 10
uint8_t buf[buffsize];
uint8_t buflen = buffsize;
 
RH_ASK driver(2000, 3, 12, 0);
 
 
void setup() 
{
  Serial.begin(9600);
  driver.init();

    initialisation_interruption ();
    pinMode(2, INPUT);
    digitalWrite(2, HIGH);
    pinMode(13, OUTPUT);
    digitalWrite(13, LOW);
}
void loop() 
{
 delay (5000);
}


void initialisation_interruption ()
{
    attachInterrupt(digitalPinToInterrupt(2), led, CHANGE);
    attachInterrupt(digitalPinToInterrupt(3), remote, CHANGE);
}

void remote ()
{
    uint8_t buf[4]; 
  uint8_t buflen = sizeof(buf); 
    if (driver.recv(buf, &buflen))
     { 
        int i;
         Serial.print("Bouton: "); 
         Serial.println((char*)buf); 
     }
}

void led ()
{
        if (digitalRead(2))   
   {
    digitalWrite(13, LOW);
   }  
     else if (!digitalRead(2)) 
      { 
       digitalWrite(13, HIGH);
      } 
}

And so this is my output:
Capture