Gateway to Node communication causing duplicate postings

Started by adumas, September 19, 2014, 01:07:09 PM

adumas

I would like the gateway to send data to different nodes on the network.

I added this code on the gateway, but on the node, but it appears to be executing multiple times on the gateway.
As a result the node is getting multiple messages as well.

What am I doing wrong....

//if nodeID = 3, then send the char array sender to nodeID 4
    if (tempID == 3 ){ 
       if (radio.sendWithRetry(4, sender, sizeof(sender), 0)){  // 0 = only 1 attempt, no retries
          Serial.println("");Serial.print("error in sending data to node 4");
       }else{ 
          Serial.println("");Serial.print("successfully sent data to node 4");
       }   
    } 

Felix

Hi, you haven't shared much code to look at, and I'm not completely following what's going on. Are you using some stock gateway sketch or something you've created yourself?
If you want to send with no retries, just use send() instead of sendWithRetry().

adumas

My goal is to have a central gateway --- that receives info from 5 nodes.  A 6th node will just receive periodic messages from the gateway.

The gateway is receiving data just fine from all nodes.

When I specify a specific node id, here number 4, I get duplicate broadcasts with the sendWithRetry or I get a compile error trying to use the send function.

sender is the char array variable that I am trying to send to node number 4

the syntax I am using is:
       send(4,sender,sizeof(sender),0))

PGMTest.ino: In function 'void loop()':
PGMTest.ino:193: error: could not convert 'radio.RFM69::send(4u, ((const void*)((char*)(& sender))), 50u, false)' to 'bool'

Felix

Send has this signature:
void send(byte toAddress, const void* buffer, byte bufferSize, bool requestACK=false);

You're trying to convert a char variable to a void pointer of length 50? I would probably just do a sprintf into a buffer of size 1 instead, to avoid all the pointer conversion confusion.
Can you post both your sketches so we have something real to look at?