Blank Serial Monitor Problem

I tried both IDE 1.8.19 and 2.0. I have Arduino Uno R3. Nothing is displayed on the Serial Monitor and doesn't accept input. How can I fix the problem?

#include <Servo.h>
Servo servo01;
String string01;
void setup() 
{
  servo01.attach(3);
  servo01.write(0);
  Serial.begin(9600);
  Serial.println("Test01");
  if(Serial.available())
  {
  Serial.println("1 - Open Left Hand");
  Serial.println("2 - Close Left Hand");
  Serial.println("3 - Open Right Hand");
  Serial.println("4 - Close Right Hand");
  Serial.println("5 - Turn Left Wrist Left");
  Serial.println("6 - Turn Left Wrist Right");
  Serial.println("7 - Turn Right Wrist Left");
  Serial.println("8 - Turn Right Wrist Right");
  Serial.println("9 - Move Left Elbow Up");
  Serial.println("10 - Move Left Elbow Down");
  Serial.println("11 - Move Right Elbow Up");
  Serial.println("12 - Move Right Elbow Down");
  Serial.println("13 - Turn Left Arm Left");
  Serial.println("14 - Turn Left Arm Right");
  Serial.println("15 - Turn Right Arm Left");
  Serial.println("16 - Turn Right Arm Right");
  }
}
void loop() 
{
  //if(Serial.available())
  //{
  //  string01 = Serial.readString();
  //  if (string01 == "1")
  //  {
      servo01.write(180);
      delay(1000);
  //  }
  //  if (string01 == "2")
  //  {
      servo01.write(0);
      delay(1000);
  //  }
  //}
}

This will only be true if there is incoming data, which is not likely so soon after startup. The string "Test01" should be printed though.

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.