My problem is that I have NRF24L01 sending and receive modules. At the moment the receiver is configured to receive two bytes. I want to rewrite the receiver code so that it can either receive two bytes as now or receive 13 bytes, depending on whether a condition is met. I can't use the NRF dynamic payload option (I think) because I don't have the option of reprogramming the existing transmitters which are stuck with the two byte payload.
Also, I can't use any of the NRF libraries because the SPI functionality within them seems to conflict with other libraries and peripherals. The existing transmitters are using ATTINY84s which makes it complicated.
So I thought that I would declare a dynamic array globally in the receiver code and then specify its size in setup(). I have never used dynamic variables so I'm not sure what I am doing wrong. At the moment I just want to set the size unconditionally in setup
So I start with this at the top
byte TX_PLOAD_WIDTH = 0; // unsigned char* tx_buf = 0;
Then in setup() I have this
delete tx_buf; tx_buf = new unsigned char [TX_PLOAD_WIDTH];
It doesn't work. It only works if I declare the array size at the start but then I can't change it. Help, please.