IF never reached , whynot

I have to decode a string from the serial input.
The input string looks likrnthis "99.0,99.0"
This is the sub:

void readData(char ch) {
  Serial << "Received: " << ch << endl;
  if (ch == ",") {
    Serial << "Calculate X" << endl;
  }
}

but the IF with the "," is never reached.
Any suggestions

if (ch == ",") {

Try

if (ch == ‘,’) {


Edit

snippets make things difficult to see what’s happening.

but the IF with the "," is never reached.

I'm finding it hard to follow the logical process that leads you to this conclusion

larryd:
if (ch == ",") {

Try

if (ch == ‘,’) {


Edit

snippets make things difficult to see what’s happening.

It works THNX

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.