Turning LED on using nrf24l01

Hi Guy,
I just cant seem to do this and I need your help.
I am trying to turn a LED on using nrf24l01 module. I am using Arduino Duemilanove. If I can turn on LED I can use the code to turn on relay and eventually control lights in the house.
Following is my code, ofcourse I am trying to modify someone else's. Im not very good in C, just trying to learn using Arduino.
Thanks.

TX code :
#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>
int i;
void setup(){
Serial.begin(9600);
Mirf.spi = &MirfHardwareSpi;
//Mirf.csnPin = 10; (This is optional to change the chip select pin)
//Mirf.cePin = 9; (This is optional to change the enable pin)
Mirf.init();
Mirf.setTADDR((byte *)"serv1");
Mirf.payload = 32;
Mirf.config();
Serial.println("Beginning ... ");
}
void loop(){

if (Serial.available()) {
i = Serial.read();
Serial.println(i);

Mirf.send((byte *) i);
delay (500);

}
}

RX code :
#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

int led = 4;

void setup(){
pinMode(led,OUTPUT);
Serial.begin(9600);
Mirf.spi = &MirfHardwareSpi;
//Mirf.csnPin = 10; (This is optional to change the chip select pin)
//Mirf.cePin = 9; (This is optional to change the enable pin)
Mirf.init();
Mirf.setTADDR((byte *)"serv1");
Mirf.payload = 32;
Mirf.config();
Serial.println("Beginning ... ");
}

void loop(){

byte data[0]; // or int data[32];
if(!Mirf.isSending() && Mirf.dataReady()){

Serial.println("Got packet");
Mirf.getData((byte *) &data);

Serial.println(data[0]);
if (data = 97) {
digitalWrite(led,HIGH);
}
else {
digitalWrite(led,LOW);
}
}

}

if (data = 97) {

Assigning the value to 97 hardly seems likely to be what you want to do. Comparing the value in data to 97 (==) seems more likely.

Of course, comparing it to 'a' seems even more likely:

if(data == 'a')
{

Thanks for replying Paul.

It wont take :
if(data == 'a')
{
says, forbidding comparing between pointer and integer.
So, tried :
if (data == (byte *) 'a') {

But not working... :frowning:

byte data[0];

It's pretty stupid to declare an array that can hold 0 elements. It's even more stupid to then write more than 0 bytes to that array.

          Mirf.getData((byte *) &data);

I'm pretty sure that that & doesn't belong there.

PaulS:

byte data[0];

It's pretty stupid to declare an array that can hold 0 elements. It's even more stupid to then write more than 0 bytes to that array.

          Mirf.getData((byte *) &data);

I'm pretty sure that that & doesn't belong there.

Well, smartass, what makes you think that it doesnt belong there? It wouldnt be there if it didnt belong there.

Well, smartass, what makes you think that it doesnt belong there? It wouldnt be there if it didnt belong there.

Well, dumbass, the function expects an array as the argument. It does not expect the address of an array.

That's not the primary issue, though. The 0 element array needs to be fixed first.