Can't see digits properly in serial monitor

Hi,

i just bought an Arduino.
But i have a little problem.
When i look in the serial monitor i can't see the digits properly
like this:
1
2
A
4
P
A
K

9

Does someone now how to fix this?
That would help me a lot
thx.

btw. this is the code i used

int digit = 0;

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

void loop() {
digit=digit+1;
Serial.println(digit);
delay(1000);
}

Serial.println(digit); adds a lf and cr (or a newline). to print on one line you want: Serial.print(digit);

Looking back,I think you want Serial.write(digit);

Perhaps this?

Serial.println(char(digit));

glop:
int digit = 0;

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

void loop() {
digit=digit+1;
Serial.println(digit);
delay(1000);
}

That code works fine for me. Which version of the Arduino IDE are you using. What do you have selected in Tools > Board menu?

Please use code tags(</> button on the toolbar) when you post code on the forum so it looks like:

int digit = 0;

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

void loop() {
  digit=digit+1;
  Serial.println(digit);
  delay(1000);
}

nathancamp:
Looking back,I think you want Serial.write(digit);

CrossRoads:
Perhaps this?

Serial.println(char(digit));

It depends on the OP's goal. If it's to print the representations of each ASCII code, then yes those will do it. If it's to print an ascending sequence of numbers then those won't work(except for values of digit between 48 and 57).

Works fine for me too, (UNO, IDE V1.6.5).

@glop, have you selected 9600 baud in the serial monitor, to match the setting in the code?

@OldSteve

If it was wrong, I guess all text would be garbled?

sterretje:
@OldSteve

If it was wrong, I guess all text would be garbled?

You'd think so. It was just a thought off the top of my head. Quite puzzling. Maybe a bad USB connection?

Hi,

if i install IDE 1.6.5 i see this in my code

0=(kappa) 1=1 2=2 3=A 4=4 5=P 6=A 7=K 8= 9=9

like this:

delay(AKK);

When i write

delay(677);

So you're saying that if you type "76553" in the IDE, you see "KAPPA"?

This is beyond me. (And you're not describing things very well.)

No

if i type 1 i see 1

and if i type 2 i see 2

if i type 3 i see A

if i type 4 i see 4
if i type 5 i see P
if i type 6 i see A
if i type 7 i see K
if i type 8 i see (nothing)
if i type 9 i see 9

I surrender

Which IDE are you using?

Do you use a keyboard where the numeric keypad is integrated in the normal keys? Usually found on small laptops like e.g. File:Acer Aspire One 532h.jpg - Wikimedia Commons? If so, sounds like you have to 'push' an additional key to switch between numeric and alpha. But tat would be normal behaviour for those keyboards.

For the one linked, 1 -> J, 2 -> K, etc. Your keyboard might be different.

nope, im using the razer deathstalker as keyboard