Maker Pro
Arduino

LED Controlling Using Serial Monitor With Arduino

November 26, 2020 by Parmar Nilesh
Share
banner

Gain a better understanding about arduino hardware and software by following this simple tutorial using Tinkercad.

Hardware

Software

1 Tinkercad

In this project, we are going to blink an LED light using a serial monitor in Arduino IDE. You can easily control or blink your LED light using a serial monitor.

So how do we control LED using the serial monitor of Arduino IDE?

First, you need a small or your required LED light (5mm) and one Arduino board( Arduino UNO or MEGA or based on your requirement).

If you want to do this project on a free open source platform then you can use Tinkercad

Hardware Connections

1. Take 4 LED lights ( you can take LED based on your requirement ).

2. Connect your anode pin of LED light with Pin no 13 of Arduino ( You can use any digital Pin of Arduino) using one 220ohm resistor.

3. Connect the ground pin of the LED light with the Ground pin of the Arduino.

Coding Algorithms

1. Define PIN in coding.

2. Make the LED as an Output Pin.

3. Write bard rate in serial. begin command for serial communication between Arduino and laptop.

4. Make conditions such as If serial port read 5 then LED will start blinking or If serial port read 6 then LED will stop blinking.

You can watch the simulation by visiting the Tinkercad website

Smashing Rottis.png

Watch the full video on Tinkercad and simple LED blinking program below.

Full Project Code

void setup() {
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}
void loop() {
  if (Serial.available() > 0) {
    int state = Serial.read();
    if (state == 53) {
      digitalWrite(13, HIGH);
      Serial.println("LED ON");
    }
    if (state == 54 ) {
      digitalWrite(13, LOW);
      Serial.println("LED OFF");
    }
  }
  delay(50);
}

Author

Avatar
Parmar Nilesh

N.tech is a technical platform for those people or students who desire to learn about electronics, IoT, and electrical engineering.

Related Content

Categories

Comments


You May Also Like