Experiment 7
Task#1:Arduino IDE based first program to blink on-board LED
Code:
Output and Circuit:
Task#2: Modify the code to use the on-board digital I/O at pin 9 using build-in
functions digitalWrite.
Code:
Circuit and output:
Task #3: Switch based LED ON-OFF operation.
Code:
Output and Circuit:
Task#4:Q1: Define an array of 16 digital I/O’s
a)Using FOR loop set first 8 I/O’s as input and rest as output.
b)Now use any one input and output pin to implement the switch, led code done in
previous tasks.
Code:
Output and circuit:
Task#5:
a) Design a 4-bit binary counter (UP & DOWN separately).
b) Combine the code for up and down counter using a switch, when the switch is
pressed the counter counts upward otherwise downward
c) Use the serial monitor available on IDE to display the counter value.
Code: (A) Up Counter
Code : Down Counter :
Outputs for up and down counter:
B & C)
Code:
Output:
Circuit for part a, b, c
Task # 6: Traffic light
Code:
Circuit:
Output:
Experiment 8
Task#1 : Append the 4 BIT binary counter code developed in LAB#9 to display the BCD on 7
SEGMENT using BCD TO 7SEGMENT DECODER IC .
Circuit:
Task 2: Write new code that directly implement (0-F) on the 7 SEGMENT without using any
decoder IC.
Code:
Circuit and output:
Task #3: Write the code in IDE that reads the voltage from potentiometer connected
at any analog input available on ARDUINO DUE board and using MAP function
converts the voltage to corresponding 8-bit resolution and display the result after a
delay of 1 sec on the LEDs available on the KIT.
(Done in Lab#10 Task)
Task#4:
Q1: Consider the following diagram for laboratory experiment
Define the ports as follows
int row[4]={22,24,26,28}; // output pins
int col[4]={46,48,50,52} // input pins
First write col Pins as HIGH
Then write high to all rows and Low to R[0]
Scan all columns and check for each column as LOW
a) Write C language code that only print the characters of 1st row {1, 2, 3, A } on
serial console
b) Write C language code that only print the characters of 1st column{1, 4, 7, * } on
serial console
c) Now complete the code for all 16 keys that print the particular key value on serial
console
Code: (A)
Output:
Code: (B)
Output:
Code (C)
OUTPUT
Circuit for part A,B,C
Task#6: Use FOR loops to customize the whole code for
i) Initializing rows as output and cols as input
ii) Writing logic low to any of 4 rows and then scanning the 4 cols for logic LOW
iii) Call a function key(i,j) on each column scan, which print the key number on
serial
(Completed in task 5)
Lab#9
Task 1: ON/OFF LED by using push button
Code:
Circuit and Output:
Task #2:LED will be ON (Button pressed odd times) & LED will be OFF (Button
pressed even times)
Code:
Circuit and Output
Task # 3: Show name of group members on LCD & also on serial monitor
Code:
Output:
Circuit:
Task # 4: Show value of sensor (potentiometer) on LCD and serial monitor.
Code:
Output:
Circuit:
Task#5: Display 4 bit up counter values on LCD
Code :
Circuit and Output:
Lab#10
Task #1: Write code to make a bar graph display using 8 LEDs
Code :
Circuit and Output:
Task#2: Connect the following circuit. Where potentiometer is connected with
Analog I/O and LED is connected with one of the PWM pins located on Arduino
DUE (pin 2-13 are dedicated as PWM pins). Now connect the digital oscilloscope to
the LED connected pin and observe the waveform.
Code:
Circuit and Output:
.
Task #3: DC motor direction control:
Code :
Circuit and Output :