Control LED Using Serial Monitor

Posted on
Control Led Using Serial
Ilustration by Pixabay

Control A LED From Serial Monitor

How to Control Led Using Serial Monitor – Arduino Uno has several advantages, one of which is that we can communicate using a serial monitor.

This time we will learn to use the Arduino Serial Monitor to give orders to Arduino to turn on an LED and currently we don’t need an External LED but we use the internal LED on the Arduino. This LED is connected to pin 13.

Please enter the following code and upload it to your Arduino.

Basic Code

int led = 13;
char  i;

void setup() {
  pinMode(led, OUTPUT);

void loop() {
  if (Serial.available() > 0) {
    i =;

    if (i == '1') {
      digitalWrite(led, HIGH);

    else if (i == '0'){
      digitalWrite(led, LOW);

Now, open the serial monitor, type the number 1 then send. Then type the number 0 and send.

You can see the difference on the board. I hope this article is useful.

Leave a Reply