hi all,
i have roblem with this syntax:
char msg[] = "Arduino";
how if i will change the "Arduino" with else but with Serial monitor comunication.
thanks and sorry for my english
hi all,
i have roblem with this syntax:
char msg[] = "Arduino";
how if i will change the "Arduino" with else but with Serial monitor comunication.
thanks and sorry for my english
Sorry, but I don't understand the question. Can you post some code that shows what you are doing ? Apart from variable names code can overcome the language barrier.
You mean something like this?
char msg[] = "Arduino";
void readMsg(){
byte i = 0;
//lets read byte for byte but leave room for NULL
while(Serial.available() && i < (sizeof(msg) - 1)){
msg[i] = Serial.read();
i++ ;
}
msg[i] = '\0'; //end with NULL
}
msg[i] = '\n'; //end with NULL
\n is NOT the NULL terminator. \0 is.
You're right! Quick write error, oops...
@mochbilal, have a look at the examples in Serial Input Basics. They are simple and reliable and read the data into a char array.
...R