從 Serial 讀進字串 array
char str[40];
char inChar;
byte index = 0;
while(Serial.available() > 0){
if(index < 39){
// Read a character
inChar = Serial.read();
// Store it
str[index] = inChar;
// Increment where to write next
index++;
// Null terminate the string
str[index] = '\0';
}
}