Arduino pro Mini char compare problem

Hello everyone!
I am currently running into a weird problem with a sketch:

  • basically i am sending commands all ending with a newline for end of command("\n") from a python script.
  • The newline on the arduino side (whether using the ascii code or simple character compare) is reckognized correctly on all my other Arduinos except on the Arduino Pro Mini (8mhz, 3.3V)
  • Here is the relevant part of the code:
void loop()

    if((c == 10) || (c == 13))
      for (int i=0;i<commandIndex;i++)
        commandBuffer[i]=' ';

I am completely baffled by what is going on so if anyone has an idea, i would be very glad !
Thanks in advance!

First, the return type for is int, not uint8_t.

How do you KNOW that the CR/LF are not being recognized?

If the baud rate on the PC is 9600, and the baud rate on the 8MHz mini is also 9600, they do not match. The baud rate setting on the PC assumes a 16MHz processor on the other end.

Hello Paul , thanks for the quick reply! * you are right about the uint8_t, it was an attempts to check if the problem was present with different datatypes , i forgot to cast it (i have trying doing the compare with char & ints before, with casting etc to no avail) *i know it is not being recognized since it never goes to the part where it parses the command, after some debugging i have tried sending back all the individual elements given by, and all the characters are ok except for the newline (which is recognized as a garbage character ("à") to be more precise * wow i didn't think of the clock speed having any influence on the serial coms ! that seems kinda weird, i thought it was completely separate ...if it is the case i am in for a whole lot of other problems... but i will give that a try, thanks!

Having different clock rates should not cause a huge problem. Just put double the baud rate in the Serial.begin(BAUDRATE) in setup, or however much it needs to be for 8Mhz compared to 16Mhz. Roughly half, but I'd calculate it completely as I know that it isn't exactly 16Mhz.