Hi everybody
I need some help with char arrays, I can not make a program that reads the serial monitor, the storage it in a char array and the compare it with another pre-declarated array; I have already done the program but It doesn't as I was expecting
If someone wants to help me please I will read everything
I have already done the program
Post your code (in tags using the </> icon).
Pete
Here's another example:
void setup() {
Serial.begin(9600);
}
void loop() {
char msg[] = "Target";
char input[20];
int charsRead;
Serial.println("Type in text and click Send");
while (1) {
if (Serial.available() > 0) {
charsRead = Serial.readBytesUntil('\n', input, sizeof(input) - 1); // Look for newline or max of 19 chars
input[charsRead] = '\0';
if (strcmp(input, msg) == 0) { // Match??
Serial.println("Match");
} else {
Serial.println("No match");
}
break;
}
}
}