Hello dude,
It may be a stupid question but I just want to know about it. How to change the size of array by Serial.read() function?
Regards,
pak
Hello dude,
It may be a stupid question but I just want to know about it. How to change the size of array by Serial.read() function?
Regards,
pak
It isn't a stupid question, but it isn't a very complete question.
What are you trying to do?
How to change the size of array by Serial.read() function?
If the array is statically sized, you can't change the size of it. It is whatever the compiler allocated.
If the array is to be dynamically allocated, using malloc, then you can use whatever size you want, including a value read from the serial port. Note, though, that the Arduino does not have a lot of memory, and dynamic allocation can lead to all kinds of problems (when you forget to free stuff, especially).
pak:
It may be a stupid question but I just want to know about it. How to change the size of array by Serial.read() function?
IIRC, if you are referring to the buffer, it used to be 128 bytes (pre Arduino 1.0), now it's 64 bytes. Is your concern that you won't be able to read longer messages coming over the serial bus?