Exp 1a – Blink Inbuilt LED
void setup()
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Exp 1b – Blink External LED
int LED = 8;
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED, OUTPUT);
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Exp 2 – Arduino based Voltage measurement
#include "LiquidCrystal.h" // include library to interface LCD module with Arduino board
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // pins of LCD module to be used
float voltage = 0.0;
float temp=0.0; // variable to store digital vaue of the input
int analog_value; // variable to store analog value at the input
void setup()
lcd.begin(16, 2); // start communication with LCD
lcd.setCursor (0,0); // start the cursor from the beginning
lcd.print(" Arduino based "); // Print text in first line
lcd.setCursor(0,1); // Move the cursoor to the next line
lcd.print("Digital Voltmeter"); // print text in second line
delay(2000); // wait for two secnds
void loop()
analog_value = analogRead(A0); // Reading the analog value
temp = (analog_value * 5.0) / 1024.0; // onverting the analog value in digital
voltage = temp/(0.0909);
if (voltage < 0.1)
voltage=0.0;
lcd.clear(); // Clear any text on the LCD
lcd.setCursor(0, 0); // Mve the cursor to the initial position
lcd.print("Voltage= "); // Print Voltgae=
lcd.print(voltage); // Print the final digital value of voltage
lcd.setCursor(13,1); // move the cursor
lcd.print("V"); // print the unit of voltage
delay(100); // wait for .1 seconds