When running the below code, which supposed to reciever data using a Nrf24, it uploads fine. But when I try to open the serial monitor to verify that it works, I get the following message.
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
And it won't open. Trying to open in again simply results in the same thing. I am not very good with these things and am at a loss. Any help would be appreciated. My entire sketch is as follows:
void loop()
{
if ( radio.available() )
{
//Read the data payload until we've received everything
bool done = false;
while ( ! done )
{
// get the data payload
Delta_G:
Usually when you see that error it means you've left the closing quote off a string somewhere.
This can happen during compile, not when opening the serial monitor after a successful upload.
In the code there are some basic misunderstandings of the NRF24L01 interface.
radio.available() returns whether data is available, not that there is an operational device.
So in the case of 'there is no data available' (which will happen most of the time)
you are flooding the serial interface with "No radio available" messages, filling the tx buffer up
and slowing your main loop to the speed of the serial running with 9600 baud.
Your while (!done) loop will copy all available packets to the same buffer,
leaving you with a copy of the last message only.
Both is probably not connected to your crashing serial monitor.
Somehow I have the feeling I have seen this code before, where did you copy it?