nRF24l01 LED; Momentary Switch State/Brightness

avr_fred:
You cannot "evolve" code that does not work. You're making needless and unnecessary changes at this point.

Hint:

Your original RX sketch works. The TX sketch radio code will work but there are simple logic errors preventing it.

Go back to your original code and debug your transmit logic. Add a Serial.begin(9600); block in setup() and then use Serial.println commands to echo values to the console to figure out what you're transmitting and you'll see some of your mistakes right away. Print all of the values of interest like this:

    Serial.print("val= ");

Serial.print(val);
   Serial.print("  old_val= ");
   Serial.print(old_val);
   Serial.print(" state= ");
   Serial.println(state);




Among the errors is constant transmission. You only need to transmit a message when "state" changes. Fixing that will simplify the logic and you may see where you've gone wrong.

Okay. So I've done this. It's interesting to say the least.

When I press the button, nothing happens. Not on the monitor or physically.

However when I press the reset button on the Arduino, the serial monitor displays "0 old_val= 0 state= 0"

So clearly the Arduino isn't even registering the fact that I'm pressing the button. old_val will never change without a new val to replace it. But state should be 1 as default.