Arduino Uno R3: Serial Monitor

Learn how to code and show serial monitor output.
 

Materials Needed

  1. Arduino Uno R3 with cable.
  2. 1x Breadboard Solderless.
  3. 1x LED.
  4. 2x Jumper.

Step 1

Connect a jumper to board and GND

Step 2

Connect a jumper to board and pin number 2

Step 3

Connect LED to board between 2 jumpers while positive side connected to jumper pin number 2 and negative side to jumper GND

Simple Programming Example

Basic code to get Serial Monitor output:

//LearnIoT Academy
//Open Close LED with Serial Monitor
int led = 2;    //LED pin numbers
void setup() {
    Serial.begin(9600);   //To setup Serial Monitor with 9600 baud output
    pinMode(led, OUTPUT); // Initialize the LED pin as an output
}

void loop() {
    Serial.println(led);     //To print output at serial monitor everytime led goes on
    digitalWrite(led, HIGH); // Turn the LED on
    delay(1000);             // Wait for a second
    digitalWrite(led, LOW);  // Turn the LED off
    delay(1000);             // Wait for a second
}
            
 

Summary

The Serial Monitor will show output of “2” everytime the LED was light up.
The LED that light up for 1 seconds and then off for 1 seconds based on Serial Monitor.
     

Previous Next