Sorry for not including any updates regarding the code, here is it.
#include <RH_ASK.h>
#include <SPI.h>
RH_ASK driver;
boolean check=true;
int buttonState = 0;
const int buttonPin =2;
int PIR =7;
void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, LOW);
pinMode (PIR,INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(13, check);
buttonState = digitalRead(buttonPin);
int sense = digitalRead(PIR);
if (buttonState== LOW){check = false;}
else if (buttonState == HIGH){if (check == true){;}
else if (sense == HIGH){check = true;}}
Serial.println(sense);
if( check == true){
const char *msg = "a";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
Serial.println("yay");}
}
I altered the setting so that the button with resistor can work, but the rest is still the same as per se.
I have attached the picture of the configuration and the freeze error that occured.
Thanks

