Serial Monitor doesn't show anything

I just uploaded this code:

void setup()
{
  pinMode(5, INPUT_PULLUP);
 
  Serial.begin(9600);
  Keyboard.begin();
}
 
void loop()
{
    if(digitalRead(5)==LOW){
    Keyboard.press('d');
    Serial.print(5);
      delay(80);}
    if(digitalRead(5)!=LOW){
      Keyboard.release('d');
      delay(80);}
       
}

to my teensy 2.0

When I press my pushbutton, d is pressed ,
my serial monitor however, stays blank.

Did I break my board or is something wrong with my arduino?

You have to wait for Serial to become available on the Leonardo:

 //Initialize serial and wait for port to open:
  Serial.begin(9600); 
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

I use a teensy though.

If I add this to my code, nothing works anymore.
I guess it keeps waiting for the serial port.

When you print the value 5, what do you expect to see? 5 is NOT a printable character. '5' IS.

PaulS:
When you print the value 5, what do you expect to see? 5 is NOT a printable character. '5' IS.

Serial.print(78) gives "78"

I'll give a shot anyway

EDIT: As expected, the Serial Monitor still doesn't show anything.

If you comment out the Keyboard calls, do you see serial output?

What do you get if you serial.print a message in setup right after serial.begin?

wildbill:
What do you get if you serial.print a message in setup right after serial.begin?

Nothing

When I press my pushbutton, d is pressed ,
my serial monitor however, stays blank.

Did I break my board or is something wrong with my arduino?

How do you have a keyboard wired to your arduino?

Go back to basics when there is a problem.

Write a short program which does nothing except print a message on the Serial Monitor.

...R

Robin2:
Go back to basics when there is a problem.

Write a short program which does nothing except print a message on the Serial Monitor.

...R

Tried that as well, nothing shows up.

I'll just order a new board.

excd:
I'll just order a new board.

That seems a bit drastic.

Post your simple test code.

Do you have another Arduino that works properly?

Have you tried uninstalling and reinstalling the Arduino IDE?

Have you tried to see if Serial.print() will work with another terminal program on your PC - puTTY or Realterm, for example?

Can I assume you do know how to open the Serial Monitor window?

...R

Robin2:

excd:
I'll just order a new board.

That seems a bit drastic.

Post your simple test code.

Do you have another Arduino that works properly?

No.

Have you tried uninstalling and reinstalling the Arduino IDE?

Yes.

Have you tried to see if Serial.print() will work with another terminal program on your PC - puTTY or Realterm, for example?

No.

Can I assume you do know how to open the Serial Monitor window?

Yes.

I really appreciate your effort but I'll just order a new board, they are not that expensive.

excd:
Did I break my board or is something wrong with my arduino?
...
I use a teensy though.

Ah, relevant details emerge. So it's not an Arduino.

The Teensy, as I recall, needs its own IDE installed. Did you install it?

Have you tested something simple, like uploading a Blink sketch? Does it upload? Does it blink? If you vary the blink rate does the new rate appear?

There are special steps for uploading to the Teensy.

https://www.pjrc.com/teensy/loader.html

They have a support forum:

http://forum.pjrc.com/forum.php

Not being able to upload something trivial seems to be an issue to take to their forum, especially if you are planning to toss it away and get another one.

I stated that I'm using a teensy 2.0 in the OP.
When I wrote arduino I was talking about the program, not my board.

They won't even let you upload it if you don't install the IDE.

The keypress works, as stated in the OP.
Leds also work.

Oops, missed that line.

Can you post your amended sketch?

Also if you believe you have a faulty Teensy (which it sounds you do) you should discuss it on their forum.

void setup() 
{
  pinMode(5, INPUT_PULLUP);
  pinMode(6, OUTPUT); 
  
  Serial.begin(9600);
  Keyboard.begin();
}

void loop()
{
    if(digitalRead(5)==LOW){ 
    Keyboard.press('d');
    Serial.print(5);
    digitalWrite(6, HIGH);
      delay(80);}
    if(digitalRead(5)!=LOW){
      Keyboard.release('d');
      digitalWrite(6, LOW);
      delay(80);}
        
}

On my Teensy 3.0 I got their HelloSerialMonitor sketch to work. However one trick was that you have to select the serial port from the Tools -> Serial Port menu after the sketch starts. Did you do that?

The Teensy, as I recall, needs its own IDE installed. Did you install it?

The Teensy needs an addin to the Arduino IDE installed, not a separate IDE.

When I installed it, it changed so much stuff that I mentally earmarked that as a "new" IDE, renamed it, and got my old one back for normal development.

Compare the Tools menu:

Normal:

Teensy: