Controlling a LED over RF

I am still pretty new to arduino so please bear with me.

I am trying to control a LED over a little 433mhz rf transmitter. i found a sample code that worked but it was pretty glitchy, the receiver would pick up random waves and make the led blink. It got even worse when i hooked up an LED.

So i had an idea to use another code that allows me to send text from one arduino to another and have the text show up in the serial monitor. With this code i am trying to figure out how to make arduino 2 read the text from arduino 1 and instead of just printing on the serial monitor have arduino 2 recognize the characters and turn the LED on or off depending on the characters i assign. this way interference will not make the led accidentally turn on or off. It will be looking for a specific character or characters.

here is the code i am working with.

Transmitter Code:

/*
SimpleSend
This sketch transmits a short text message using the VirtualWire library
connect the Transmitter data pin to Arduino pin 12
*/
#include <VirtualWire.h>
void setup()
{
// Initialize the IO and ISR
vw_setup(3000); // Bits per sec
}
void loop()
{
send(“H”);
delay(2000);
}
void send (char *message)
{
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone
}

this is the receiver code:

/*
SimpleReceive
This sketch displays text strings received using VirtualWire
Connect the Receiver data pin to Arduino pin 11
*/
#include <VirtualWire.h>
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
int LEDPin = 4;
int incomingByte;
void setup()
{
Serial.begin(9600);
Serial.println(“Device is ready”);
// Initialize the IO and ISR
vw_setup(3000); // Bits per sec
vw_rx_start(); // Start the receiver
pinMode(LEDPin, OUTPUT);
//digitalWrite(LEDPin, HIGH);

}
void loop()
{
if (vw_get_message(message, &messageLength)) // Non-blocking
{
Serial.print("Received: ");
for (int i = 0; i < messageLength; i++)
{
Serial.write(message*);*
if(I dont know what should go here? = ‘H’){

  • digitalWrite(LEDPin, HIGH);*
    }
    else if(I dont know what should go here? = ‘L’)
    {
  • digitalWrite(LEDPin, LOW);*

}
}
Serial.println();
}

I did something like this recently.
I was reading Arduino Workshop book.

..

I figured it out. i found what the H and L was read as and it came out to be 72 and 76. so i just had it wait for 76 to change to 72. on the transmitter i made a button change the letter that was being sent. Thanks for the reply.

here is the code.

/*
SimpleReceive
This sketch displays text strings received using VirtualWire
Connect the Receiver data pin to Arduino pin 11
*/
#include <VirtualWire.h>
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
int LEDPin = 4;
int PIN = 11;
int incomingByte;
void setup()
{
//Serial.begin(9600);
//Serial.println(“Device is ready”);
// Initialize the IO and ISR
vw_setup(5000); // Bits per sec
vw_rx_start(); // Start the receiver
pinMode(LEDPin, OUTPUT);
//digitalWrite(LEDPin, LOW);

}
void loop()
{
if (vw_get_message(message, &messageLength)) // Non-blocking
{
//Serial.print("Received: ");
for (int i = 0; i < messageLength; i++)
{
//Serial.print(message*);*
pinMode(PIN, INPUT);
int RFin = (message*);*
int H = 72;
int L = 76;
//Serial.print(RFin); //read RFin
if(RFin == 72) { // motor on command
* digitalWrite(LEDPin, HIGH);*

}
else if(RFin == 76)
{
* digitalWrite(LEDPin, LOW);*

}
}
//Serial.println();
}
}