analogWrite freeze the arduino

Isn't this the problem?

int r = firstValue.toInt();
int g = secondValue.toInt();
int b = thirdValue.toInt();

These are ints (0x0000 to 0xFFFF), while analogWrite expects bytes (0x00 to 0xFF)?