This used to work now all of a sudden, on multiple PCs using Megas
unsigned char thisByte = Serial.read() ; will not accept extended ascii characters and display its byte value. ascii characters between 33-127 will serial print thier byte values to the serial monitor.
example code:
unsigned char thisByte; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop()
{ while ( !Serial.available() );
thisByte = Serial.read() ;
Serial.println(thisByte, DEC);
}
type "d" in the serial monitor -> outputs 100
type in "ÿ" (which is 255) in the serial monitor -> outputs 195 191
this always worked in the past but now it doesnt. any insight?
I would think that your keyboard is encoding ÿ as UTF16 UTF-16 - Wikipedia, which uses 2 bytes for for each character. Why it's doing that now if it didn't before is for someone else to answer.
Whatever the underlying cause, it is not that serial read won't read bytes over 128.