Code for RF module push button LED

Hi, I am new to the Arduino. I am using two Arduino Unos with a RF module (433mhz). My goal is to push a button to send a signal through the digital I/O on one Aduino to the analog port on another Arduino turning on an LED. I am very novice to coding and have tried different things but can't seem to get the signal through. Any help/advice would be appreciated! Thank you!

Any help/advice would be appreciated!

Post your code!

Paul,

This is the code initially used to test the transmitter/receiver. It worked as should. What i am trying to figure out how to do is instead of it sending a constant signal on a loop i would want to change it to where i press a push button to send the signal then turn on the LED
TX Code

#define rfTransmitPin 4 //RF Transmitter pin = digital pin 4
#define ledPin 13 //Onboard LED = digital pin 13

void setup(){
pinMode(rfTransmitPin, OUTPUT);
pinMode(ledPin, OUTPUT);
}

void loop(){
for(int i=4000; i>5; i=i-(i/3)){
digitalWrite(rfTransmitPin, HIGH); //Transmit a HIGH signal
digitalWrite(ledPin, HIGH); //Turn the LED on
delay(2000); //Wait for 1 second

digitalWrite(rfTransmitPin,LOW); //Transmit a LOW signal
digitalWrite(ledPin, LOW); //Turn the LED off
delay(i); //Variable delay
}
}

RX Code

#define rfReceivePin A0 //RF Receiver pin = Analog pin 0
#define ledPin 13 //Onboard LED = digital pin 13

unsigned int data = 0; // variable used to store received data
const unsigned int upperThreshold = 70; //upper threshold value
const unsigned int lowerThreshold = 50; //lower threshold value

void setup(){
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop(){
data=analogRead(rfReceivePin); //listen for data on Analog pin 0

if(data>upperThreshold){
digitalWrite(ledPin, LOW); //If a LOW signal is received, turn LED OFF
Serial.println(data);
}

if(data<lowerThreshold){
digitalWrite(ledPin, HIGH); //If a HIGH signal is received, turn LED ON
Serial.println(data);
}
}

What kind of devices are you using to send and receive data? RF typically does not send analog data, so reading analog data doesn't seem right.

What i am trying to figure out how to do is instead of it sending a constant signal on a loop i would want to change it to where i press a push button to send the signal then turn on the LED

What mechanism you use to decide that an output pin should be HIGH is up to you. That is all that that code is doing. Though I can't believe that that code actually works.

Please use code tags ("</>" button).

To reliably send data or messages, use the VirtualWire or RadioHead libraries.

433Mhz RF Transmitter And Receiver Kit For Arduino Project Model MX-05V