IDE serial monitor not working

The serial monitor (Ctrl+Shift+M) is not working for the follow code. Otherwise the code works for the servo.

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 10; // variable to store the servo position

void setup() {
myservo.attach(10); // attaches the servo on pin 10 to the servo
Serial.println("Hello World");
}

void loop() {
for (pos = 10; pos <= 170; pos += 2) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 170; pos >= 10; pos -= 2) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}

Where is your Serial.begin(); ?

Neither Ctrl+Shift+M nor the Serial Monitor button on the IDE work for this corrected code:

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 10; // variable to store the servo position
void setup() {
myservo.attach(10); // attaches the servo on pin 10 to the servo
Serial.begin(9600);
delay(25);
Serial.println("Hello World");
}

void loop() {
for (pos = 10; pos <= 170; pos += 2) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 170; pos >= 10; pos -= 2) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}

Neither Ctrl+Shift+M nor the Serial Monitor button on the IDE work for this corrected code:

What does not working mean, exactly ?
Does the Serial monitor window open ?

Which Arduino board are you using ?
What baud rate is the Serial monitor set to ?

Why did you start a second thread on the same subject ?

No Serial.begin();

Yes there is....

(edit: That refers to UKHeliBob's posting which he edited after I had posted and didn't do a strikeout, just pretended he never said it.)

Works for me, and for good measure I put an extra print inside loop().

495106.GIF

495106.GIF

Thank you. Windows Device Manager Ports "Arduino Uno (COM4)" properties are "bits per second 9600" and "working properly". The servo is working.

The Serial Monitor window does not open.

WJGJRG:
The Serial Monitor window does not open.

It sounds like a reinstall of the IDE might be in order.

Which version have you got installed and on what Operating System ?

I am using IDE 1.8.3 on Windows 10. I tried this same sketch on another windows 10 computer running 1.8.1 and it works: Serial Monitor window comes up with "Hello World".

Perhaps it's a glitch in 1.8.3? I'm still on 1.6.something iirc.

Perhaps it's a glitch in 1.8.3?

1.8.3 was released 5/31/17. I can't believe that it has been in service for over 2 months and someone just realizes that the Serial Monitor does not work with Windows 10.

Try a reinstall of 1.8.3 before posting an official bug report.

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags:
[code]`` [color=blue]// your code is here[/color] ``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

Do you see any new output in the black console window at the bottom of the Arduino IDE window after you try to open Serial Monitor? If so, please post it here using code tags.

I reinstalled IDE 1.8.3 and now the Serial Monitor works. Thank you for all of your suggestions and help.