"radio.write()" doesn't

I have this code:

// SimpleTxAckPayload - the master or the transmitter

#include <SPI.h>
//#include <nRF24L01.h>
#include <RF24.h>


#define CE_PIN   7
#define CSN_PIN  8

const byte slaveAddress[5] = {'R','x','U','N','O'};

RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

char dataToSend[10] = "abcDEFg  ";
char txNum = '0';
int ackData[2] = {-1, -1}; // to hold the two values coming from the slave

unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 5000; // send once per 5 second


bool newData;

void send();
void showData();
void updateMessage();

//===============

void setup() {

    Serial.begin(9600);

    Serial.println("SimpleTxAckPayload Starting");

    radio.begin();
    radio.setDataRate( RF24_250KBPS );

    radio.enableAckPayload();

    radio.setRetries(3,5); // delay, count
    radio.openWritingPipe(slaveAddress);
}

//=============

void loop() {

    currentMillis = millis();
    if (currentMillis - prevMillis >= txIntervalMillis) {
        send();
    }
    showData();
}

//================

void send() 
{
   // local variable
   bool rslt;

   Serial.println( "Sending Data" );

   rslt = radio.write( &dataToSend, sizeof(dataToSend) );
   // Always use sizeof() as it gives the size as the number of bytes.
   // For example if dataToSend was an int sizeof() would correctly return 2

     Serial.print("Data Sent ");
     Serial.print(dataToSend);

    
   if (rslt) 
   {
      if ( radio.isAckPayloadAvailable() ) 
      {
         radio.read(&ackData, sizeof(ackData));
         newData = true;
      }else{
         Serial.println("  Acknowledge but no data ");
      }  // end if ( radio.isAckPayloadAvailable() )
        
      updateMessage();
  }else{
    Serial.println("  Tx failed");
  }  // end if (rslt)

  prevMillis = millis();
}  // end send()

//=================

void showData() {
    if (newData == true) {
        Serial.print("  Acknowledge data ");
        Serial.print(ackData[0]);
        Serial.print(", ");
        Serial.println(ackData[1]);
        Serial.println();
        newData = false;
    }
}

//================

void updateMessage() {
        // so you can see that new data is being sent
    txNum += 1;
    if (txNum > '9') {
        txNum = '0';
    }
    dataToSend[8] = txNum;
}

When I run it, it get to the debug line (67) and stops. It appears to refuse to send the data.

Can someone suggest why? Uncommenting #include <nRF24L01.h>” makes no difference.

If you want my help please ask the moderator to merge this with your earlier Thread on your wireless project. Even in that one you had links to 2 or 3 earlier Threads.

I am tired of seeing your project in tiny pieces.

...R

No worries.

I found it.

An earth line on the breadboard had come unplugged. Now all works just fine.

Robin2:
If you want my help please ask the moderator to merge this with your earlier Thread on your wireless project. Even in that one you had links to 2 or 3 earlier Threads.

This was a totally different question, robin2. And the link in my earlier post was to a thread more than two years old - not my thread either. Also, neither of these posts had anything to do with my code - I have been looking at other people’s code trying to find out how it works. When I identify that I’ll use it in my project. That project I’ll keep in one thread.

vagulus:
This was a totally different question, robin2. And the link in my earlier post was to a thread more than two years old - not my thread either.

This is the other Thread I was referring to. Now that I look at it again I see that it does refer to someone else's Thread. Apologies.

However I do recall that you have a lot of different Threads on what seems to me to be a single project. It is much easier for my little brain if everything about a project is in one Thread - even if the Thread becomes long and if the focus of the questions change. When there are multiple small Threads I find it impossible to remember what was said earlier. You have the advantage that you are only dealing with your project. I read and respond to a lot of very different Threads.

...R

robin2

I appreciate that you deal with many threads and many subjects. Where we are wrestling with a single program, as we did a couple of months back, I can see logic in keeping things in the one thread. However, where there is a single, clear-cut issue, and we come up with a single, clear-cut solution, there is no need to check back for anything.

Furthermore, in that case, and if the subject line is appropriate, then that issue, and that solution, is searchable. That means that people with the same problem can find the solution just with a search - we don't have to go through the agony again.

There must be some advantage in that.