Switch/Case not responding as expected

gharryh:
The result now is that the display shows <255> and then freezes

Well, that is some progress, but I still think it is because you need to null terminate what you are sending to the serLCD.print routine. Though 255 is a bit odd. There isn't anything holding the Rx pin (pin 0) high is there?

Maybe this can help. To send data to the Arduino i use the IDE monitor.
When i typein 1234567890 the result in the display becomes <141>

what happens it you do serLCD.write(character); ?

When i typein 1234567890 the result in the display becomes <141>

AT least that means that the switch statement works as expected.

So the main problem seems to me the communication

Step 1 PC -- UNO test

int cnt = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  If (Serial.availabale() > 0)
  {
    Serial.print(Serial.read());
    cnt++;
  }
  if (cnt > 40)   // to prevent very long lines.
  {
    Serial.println();
    cnt = 0;
  }
}

CAn you try this one, does it echo the characters you type in (after enter)

Yea I just did it on my lcd, and print gives 480, @ 1234567890, and Write gives 1 @ 1234567890.

I also typed SAM with Serial.Write, and got S, not a crazy number.

robtillaart:

When i typein 1234567890 the result in the display becomes <141>

AT least that means that the switch statement works as expected.
So the main problem seems to me the communication
CAn you try this one, does it echo the characters you type in (after enter)

It returns nothing, but strangly using that same connection i can program the duo.
Also tested it on a nano with the same result.

As this is a simple echo program the Serial monitor should see the very same characters back.
The fact that that not works makes me wonder if the serial works OK.

Thereis something strange happening.
Using the IDE serial monitor nothing is returned, even a extra Serial.print("Hello World"); in the setup.

As both Deumilanov and the Nane had the same results i tried it with a seperate terminal program.
Hoera success sending 123 returned 495051

Is it possible that the IDE monitor doesnt change to the programmed 9600 baud.
So lets try it by changing the baudrate in the sketch to 115200 and yes the sketch returns the input now.

The question know is this normal or a fault in de IDE or my computer.

So i recompiled my first sketch again with a baudrate 115200 and the sketch works.
Lost a day finding out som strange behaivior of the IDE or ditnt i read the docs full?

What does the baud rate in the lower right corner of your serial monitor say? 9600 or 115200?

Shame on me as the bottom part of the monitor screen ran out to the bottom of my screen and i ditnt see the baudrate down there. 8) :fearful: