TolpuddleSartre:
Without actually writing your code for you, I didn't know how to make it more obvious, so I thought maybe bold/underline might do the trick.
im pretty sure the problem is with newData = false , here is the whole code minus what starts it in the loop.
void recvWithEndMarker() {
static byte ndx = 0;
char endMarker = '\n';
char rc;
while (Serial.available() > 0 && newData == false) {
rc = Serial.read();
if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
}
else {
receivedChars[ndx] = '\0'; // terminate the string
ndx = 0;
newData = true;
}
}
}
void showNewData() {
if (newData == true) {
Serial.print("This just in ... ");
Serial.println(receivedChars);
if (strcmp(receivedChars, "test 2") == 0) {
Serial.println("working 2");
}
newData = false;
}
if (strcmp(receivedChars, "test 1") == 0) {
Serial.println("working 1");
}
newData = false;
}
please go ahead a rewrite it because i dont know what your talking about