Arduino Setup by Prof Vaibhav Srivastava
Arduino Setup by Prof Vaibhav Srivastava
Serial Monitor
Serial Communication: Used for communication between the Arduino board and a
computer or other devices. All Arduino boards have at least one serial port (also known as a
UART or USART), and some have several.
UART Communication: UART, or “Universal Asynchronous Receiver-Transmitter”, is one
of the most used device-to-device communication protocols.
Let’s us understand with a small program i.e. WAP to print the output for the given
character as an input.
Let us understand more with a help of program i.e. WAP to print element 4 from
integer array {2,3,4,5,6}, print element e from character array {‘a’, ‘b’, ‘c’, ‘d’,
‘e’} and print element banana from String array {“apple”, “mango”, “banana”}
Digital I/O Functions in Arduino Programming
pinMode(): - Configures the specified pin to behave either as an input or an output.
Syntax: -
pinMode(pin,mode);
Here pin stands for Digital pin or Analog pin where as mode stands for “INPUT” to
receive a signal or “Output” to send a signal.
Ex: - pinMode(13,OUTPUT);
digitalWrite(): - Write a HIGH or a LOW to a digital pin.
Syntax: -
digitalWrite(pin,value);
Here pin stands for only Arduino Digital pins whereas value stands for HIGH (5V) or
LOW (0V)
Ex: - digitalWrite(13,HIGH);
digitalRead(): - Reads a value from a specified digital pin, either HIGH or LOW.
Syntax: -
digitalRead(pin);
Here pin stands for Arduino Digital pins
Ex: - digitalRead(12);
Note: - INPUT_PULLUP: - Makes the Digital Pin High initially, until it receives a LOW
Signal from an external device.
Constants in Arduino Programming:
HIGH = 1 = true
LOW = 0 = false
Examples to turn ON LED:
digitalWrite(13,1);
digitalWrite(13,true);
digitalWrite(13,HIGH);
digitalWrite(13, 0);
digitalWrite(13, false);
digitalWrite(13, LOW);
Lets us understand Digital Pins with a help of Program i.e. WAP to Turn ON or OFF the LED
from the Ardino UNO inbuilt chip.