loading

The Arduino IDE has a feature that can be a great help in debugging sketches or controlling Arduino from your computer's keyboard.

The Serial Monitor is a separate pop-up window that acts as a separate terminal that communicates by receiving and sending Serial Data. See the icon on the far right of the image above.

Serial Data is sent over a single wire (but usually travels over USB in our case) and consists of a series of 1's and 0's sent over the wire. Data can be sent in both directions (In our case on two wires).

Step 1:

You will use the Serial Monitor to debug Arduino Software Sketches or to view data sent by a working Sketch. You must have an Arduino connected by USB to your computer to be able to activate the Serial Monitor.

To get familiar with using the Serial Monitor, Copy and Paste the following example Sketch into a blank Arduino IE window. Then Verify it and if it's OK, Upload it. The next step will show you what to expect.

EXAMPLE SKETCH: CUT and PASTE

/* YourDuinoStarter_SerialMonitor_SEND_RCVE<br> - WHAT IT DOES: 
   - Receives characters from Serial Monitor
   - Displays received character as Decimal, Hexadecimal and Character
   - Controls pin 13 LED from Keyboard
 - SEE the comments after "//" on each line below
 - CONNECTIONS:
   - None: Pin 13 built-in LED
   - 
 - V1.00 02/11/13
   Questions: terry@yourduino.com */

/*-----( Import needed libraries )-----*/
/*-----( Declare Constants and Pin Numbers )-----*/
#define led 13  // built-in LED
/*-----( Declare objects )-----*/
/*-----( Declare Variables )-----*/
int ByteReceived;

void setup()   /****** SETUP: RUNS ONCE ******/
{
  Serial.begin(9600);  
  Serial.println("--- Start Serial Monitor SEND_RCVE ---");
    Serial.println(" Type in Box above, . ");
  Serial.println("(Decimal)(Hex)(Character)");  
  Serial.println(); 
}
//--(end setup )---

void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{
  if (Serial.available() > 0)
  {
    ByteReceived = Serial.read();
    Serial.print(ByteReceived);   
    Serial.print("        ");      
    Serial.print(ByteReceived, HEX);
    Serial.print("       ");     
    Serial.print(char(ByteReceived));
    
    if(ByteReceived == '1') // Single Quote! This is a character.
    {
      digitalWrite(led,HIGH);
      Serial.print(" LED ON ");
    }
    
    if(ByteReceived == '0')
    {
      digitalWrite(led,LOW);
      Serial.print(" LED OFF");
    }
    
    Serial.println();    // End the line

  // END Serial Available
  }
}

//--(end main loop )---

/*-----( Declare User-written Functions )-----*/

/*********( THE END )***********/
<p>hey i placed a ir receiver and opened the serial monitor the codes going on it is not stoping i want want know my remote frequency but it the codes are going on plz help me </p>
<p>There is another solution to monitor serial port. Check <a href="http://www.eltima.com/products/serial-port-monitor/" rel="nofollow">http://www.eltima.com/products/serial-port-monitor/</a></p>
<p>Hi Terry,</p><p>I&rsquo;m a newbie to Arduino&hellip;&hellip;..in the past I used Flowcode V4 &hellip;.</p><p>I have a problem viewing the Serial Monitor, the pop-up<br>window does not appear&hellip;.I have tried it<br>using your &ldquo;How to use Arduino Serial Monitor&rdquo; which I download from &hellip;. (<a href="http://www.instructables.com/id/HOW-TO-use-the-ARDUINO-SERIAL-MONITOR/step3/DEBUGGING-WITH-THE-SERIAL-MONITOR/" rel="nofollow">http://www.instructables.com/id/HOW-TO-use-the-ARDUINO-SERIAL-MONITOR/step3/DEBUGGING-WITH-THE-SERIAL-MONITOR/</a>) I&rsquo;m sure I have carried out your instructions<br>correctly &hellip;I did a &ldquo;copy / paste&rdquo; of the sketch then &ldquo;Cntrl R&rdquo; to verify and &ldquo;Cntrl U&rdquo; to upload without a hitch but the<br>pop-up does not appear when I click on the sketch&hellip;..</p><p>Please help &hellip;.</p><p>Cheers for now</p><p>Manie </p>
<p>setup is missing:</p><p> pinMode(led, OUTPUT); </p>
<p>The Example Sketch is <strong>updated</strong>; it was mangled somehow by Instructables.</p>

About This Instructable

171,323views

27favorites

License:

More by YourDuino-Maker:HOW-TO use the ARDUINO SERIAL MONITOR YourDuino: HandBat - Handheld Ultrasonic Radar using Arduino YourDuino: Basic Arduino-Compatible Collision-Avoiding Robot 
Add instructable to: