weird serial problem

I tried to test the example of the playground (below) but it outputs only numbers between 48 and 56… Is there something wrong with the serial.read?

int incomingByte = 0; // for incoming serial data

void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {

// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();

// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}

From http://arduino.cc/en/Serial/Read

?

Between 48 and 56? Are you using 0 - 8 on the keyboard when you’re inputting? (0 - 8 ASCII values are equal to 48 - 56, in DECIMAL)

When you do a Serial.print(Value, DEC); it’s going to write a Decimal value (numbers) no matter what you input, it comes out as numbers. (For example… if you put ‘A’ into the Serial, it should print out ‘65’ which is ASCII for ‘A’)

Check this out:

And if you want to see what you type, just like you type it (as an ASCII character), use

Serial.println (incoming Byte);

Ah, a bit of a beginners error ::slight_smile: Thanks for the replies!
The example implies it should output the good numbers…that confused me…A simple cast makes it better a better example:

int incomingByte = 0; // for incoming serial data
char asc;
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {

// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
asc = char(incomingByte); // say what you got:
Serial.print("I received: ");
Serial.println(asc);
}
}