String equal check
in
Programming Questions
•
1 year ago
Hi
i made this little code that should execute the drawScreen() function when tempBuff equals "C".
I've tried a lot, but nothin seems to work. i've read that stringToCheck.equals(patterToCheck) should work, but it does not as i want it to... it always executes the else{}, while in the serial monitor i get that "C" printed out
and no it's not because of the drawScreen function, i've tested it without the if statement and then it works
- void serialEvent(Serial port) {
- String tempBuff = port.readStringUntil('\n');
- if(tempBuff.equals("C")) {
- printData = true;
- drawScreen();
- recCmds = new String[0];
- }
- else {
- recCmds = append(recCmds, tempBuff);
- println(tempBuff + " , " + recCmds.length);
- printData = false;
- }
- }
- void drawScreen() {
- ...
- }
1