Hey, I just got a Teensy 3.1 because it has much more memory than Arduino. This code worked on Arduino, being able to read from any Serial port and saving it to a string. However, this crashes the Teensy. Please tell me what is wrong and give me an explanation about the memory. I tried saving to heap I tried saving to stack, but to no avail. Thanks

I keep getting Available but no output with the code below. Connected to Serial3 is GPS module which works when each byte is printed rather than saved on a string.

Please help.

char readBuffer[1024];

void setup(){

void loop(){
int howBig = readSerialString(Serial3);
for( int i = 0; i < howBig; i++){


int readSerialString(HardwareSerial whatSerial){
memset(readBuffer, 0, strlen(readBuffer));
int theSize = 0;
readBuffer[theSize]=(char) whatSerial.read();
//delay(10); I tried delay to no avail.
readBuffer[theSize] = (char) 0;