Go Down

Topic: code for receiving serial data from transmitter (Read 508 times) previous topic - next topic

hi everyone,im working on flood monitoring system.here my arduino code for receiving data serially..is it this code really work?
im receiving the latitude and longitude data from the transmitter as well as the water level data..is there any changes that i have to make in order to get the code work?sorry, im very new with arduino board...tq for ur help...
Code: [Select]

#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

int rate;

void setup(){


  Mirf.spi = &MirfHardwareSpi;
  Mirf.setRADDR((byte *)"serv1");
  Mirf.payload = sizeof(rate);

void loop(){

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



Dec 11, 2012, 09:37 am Last Edit: Dec 11, 2012, 09:44 am by Graynomad Reason: 1
I've no idea what Mirf.getData() does but

Code: [Select]
int rate;
Mirf.getData((byte *) &rate);

doesn't seem right. Why are you casting the address of an int to a pointer to a byte?

If Mirf.getData() fills "rate" with more that 2 bytes you will be in trouble.

Rob Gray aka the GRAYnomad www.robgray.com

i got the code online...refering to the code...there are no initialization of pin...does it works?


.there are no initialization of pin...does it works?

You're the one with the hardware - you tell us.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131