Hello Friends, in this blog I will share with you how to control Arduino Digital Output with Serial Monitor. I am using One Arduino Uno, One 330 ohm resistor, One LED, 2 connecting cable, and one small Bread board. LED is connected to pin number 12, with the help of resistor 330 ohm. Below is the sketch: // Code by Deepak Sharma // The code is to control one digital output by serial monitor const int LED = 12; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(LED, OUTPUT); } void loop() { // put your main code here, to run repeatedly: if (Serial.available()) { String input = Serial.readStringUntil('\n'); input.trim(); if (input.equalsIgnoreCase("ON")) { digitalWrite(LED, HIGH); Serial.println("LED ON"); } else if (input.equalsIgnoreCase("OFF")) { digitalWrite(LED, LOW); ...
Hello Friends, in this blog we will be controlling digital output with serial monitor command. First let’s understand the working of serial monitor. Serial monitor in Arduino IDE is a tool which allows communication between the computer and Arduino board via a serial connection, normally we use USB cable for connection. What are the features of Serial Monitor? It shows the data sent from the Arduino board by using the functions like Serial.print() or Serial.println(). It allows to send text or numeric data to the Arduino board, which can be read by function like, Serial.read() or Serial.parseInt(), thereafter you can use this data for further analysis and action. We can use this tool for debugging and monitoring the function of the sketch. There is a procedure to use the serial monitor, below are the steps given. First initialize the serial communication in the sketch as given below. Normally baud rate is set 9600. Void setup(){ Serial.begin(9600)...