Directly after copying I can see by printing to the serial monitor that the larger array got the payload.
When I go try to get the data from the larger array in a different method it's empty. Am I doing something wrong.
Listen prints Data as expected. The next method prints 0's. Am I missing something?
byte Data[9999];
void listen()
{
int noBytes = Udp.parsePacket();
if(noBytes > 0)
{
int idx = packetBuffer[0] | packetBuffer[1] << 8;
std::copy(packetBuffer + 2, packetBuffer + 1472, Data + idx);
for(int i = 2; i < 1472; i++ )
{
Serial.println(Data[i]);
}
}
}
void next()
{
for(int i = 0; i < (the number of bytes I want from Data); i++ )
{
Serial.println(Data[i]);
}
}