RF remote help

hello, i am trying to make a RF remote to switch on 8 relays, how i intend to do it is to send characters to the receiver and use strcmp to convert it to an action. firstly is this a good method? secondly i cant get strcmp to display its value, need help. the sketch is as bellow.

transmitter

/*
SimpleSend
This sketch transmits a short text message using the VirtualWire library
connect the Transmitter data pin to Arduino pin 12
*/

const int buttonPin = 2; 
int buttonState = 0; 
#include <VirtualWire.h>
void setup()
{
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
 pinMode(buttonPin, INPUT); 
}
void loop()
{
   buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {    
send("1");
delay(100);

}
}
void send (char *message)
{
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone
}

Receiver

/*
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
void setup()
{
Serial.begin(9600);
Serial.println("Device is ready");
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver
}
void loop()
{
if (vw_get_message(message, &messageLength)) // Non-blocking
{
Serial.print("Received: ");
for (int i = 0; i < messageLength; i++)
{
Serial.print("{");
  Serial.write(message[i]);
Serial.print("}");
Serial.print("The result of strcmp is : ");
Serial.println((strcmp(message[i])));
}

Serial.println();
}
}

so basically, when receiver receiver "1" it will turn on relay 1, etc.... is this a good method? can anyone recommend a better method? and lastly, whats wrong with the strcmp? it gives an error while compiling saying

RF_Receiver.ino: In function 'void loop()':
RF_Receiver:28: error: invalid conversion from 'byte' to 'const char*'
c:/program files/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:124: error: too few arguments to function 'int strcmp(const char*, const char*)'
RF_Receiver:28: error: at this point in file

Help is much appreciated!! thanks

strcmp() is for comparing two null-terminated strings of characters. Since you are dealing with single characters it makes more sense to compare single characters:

      Serial.print("The result of compare is: ");
      Serial.println(message[i] == '1');

This should display '1' for a match and '0' for a non-match.

You can have a list series of compares to decide what to do with each input:

if (message[i] == '1')
   function1();

if (message[i] == '2')
   function2();

if (message[i] == '3')
   function3();

if (message[i] == '4')
   function4();

or you can use the 'switch' statement to make the code more compact:

switch (message[i]) {
case '1':   function1(); break;
case '2':   function2(); break;
case '3':   function3(); break;
case '4':   function4(); break;
default: Serial.println("Input not recognized");
}

Hi, Thanks alot! btw if i want to make a internal pull up resistor, how should my sketch be modified?

/*
SimpleSend
This sketch transmits a short text message using the VirtualWire library
connect the Transmitter data pin to Arduino pin 12
*/

const int buttonPin = 2; 
const int buttonPin1 = 3; 
int buttonState = 0; 
int buttonState1 = 0; 
#include <VirtualWire.h>
void setup()
{
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
 pinMode(buttonPin, INPUT); 
 pinMode(buttonPin1, INPUT);
}
void loop()
{
   buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {    
send("1");
delay(300);

}
buttonState = digitalRead(buttonPin1);
if (buttonState == HIGH) {    
send("2");
delay(300);

}
}
void send (char *message)
{
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone
}

i saw on the arduino website that i should use

pinMode(pin, INPUT);           // set pin to input
digitalWrite(pin, HIGH);       // turn on pullup resistors

but i cant seem to get it to work....thanks for the help!

DMond:
Hi, Thanks alot! btw if i want to make a internal pull up resistor, how should my sketch be modified?

Change INPUT to INPUT_PULLUP in the pinMode() calls (new feature in 1.0).

Thanks!! it worked like a charm =)