no matching function for call to 'RF24Mesh::write(String&, char, unsigned int)'

Submitted by Aadit on

hey, i am doing a project on the nrf24l01 mesh network. 

everything is going okay but when i tried to send the string from nrf node. it is giving me following error:

< exit status 1

no matching function for call to 'RF24Mesh::write(String&, char, unsigned int)'  >

 I dont understand why it is giving me error as i dont find anything wrong in the code.  

can someone tell me why this error occured. i tried everything like replacing library with suitable library and checking if the library is installed or not but no luck. 

 

hi aadit, so i went through your error and by your luck even i have encountered this error when i was doing nrf mesh network projects long before. 

so here the issue is with your sending the data type to master. if you look at the #include "RF24Mesh.h" function.  then you will notice that it cannot acccept string or you cannot pass string using the function mesh.write() 

The standard mesh.write() fucntion looks like below:

bool RF24Mesh::write ( const void *  data,
    uint8_t  msg_type,
    size_t  size,
    uint8_t  nodeID = 0 
  )

 

so here you can see that it can accept int, char, but it cannot accept String and your error says you are trying to send string. Instead of using String, you can use char data type and you wont get error. 

if you want to send "HI" to master nrf24l01 then you can write as below

char mesg[3] = {'H', 'I', '\0'};

and you can write function like:

if (!mesh.write(mesg, 'M', sizeof(mesg))) {

//check for success and return

}

try this and let me know if this helps. 

 

  Joined September 20, 2018      8
Thursday at 02:04 PM