Professional Documents
Culture Documents
Date:4.11.2023
1. INTRODUCTION
In this experiment we will learn about the Arduino. The Arduino has 16
digital pins and 6 analog pins. It has AT mega integrated circuit. We will use
built in functions that make the code more simple. We will use application
Arduino IDE to write, compile, and upload the code to the Arduino board.
The code will control the behaviour of the connected components based on
the input received from various sensors or user interactions.
2. OBJECTIVES
1. To get to know the Arduino and its parts .
2. To know how can we use the Arduino.
3. To Connect external components, such as LEDs, push buttons to the Arduino board and learn how to
interface them using the digital pins.
3. COMPONENTS REQUIRED:
ID Component name Amount
1 Arduino 1
2 Resistances 1
3 Power supply 1
4 Wires
5 USB 1
6 LEDS 2
7 computer 1
4. TASKS
Task#1: Connect two LEDs to Arduino UNO. Alternate LEDs every 0.5 seconds (One LED
is ON the other is OFF).
// C++ CODE
//
INT LEDPIN =7;
//INT LEDPIN2=5;
VOID SETUP ()
{
PINM ODE(LEDPIN , OUTPUT);
PINM ODE(LEDPIN 1, OUTPUT);
//PINMODE(LEDPIN2, OUTPUT);
}
VOID LOOP ()
{
DIGITAL WRITE(LEDPIN , HIGH);
DELAY (500); // WAIT FOR 0.5(S)
DIGITAL WRITE(LEDPIN , LOW);
DELAY (500); // WAIT FOR 0.5(S)
DIGITAL WRITE(LEDPIN 1, HIGH);
DELAY (500); // WAIT FOR 0.5(S)
DIGITAL WRITE(LEDPIN 1, LOW);
DELAY (500);// WAIT FOR 0.5(S)
Task#2: Connect a button and a LED to Arduino UNO. The LED blink every 1 second.
Each time the button is pressed and released, the blinking time is reduced by 100ms.
// C++ CODE
//
INT INPUT =3;
INT TIME=1000;
VOID SETUP ()
{
PINM ODE(INPUT , INPUT);
PINM ODE(OUTPUT , OUTPUT);
}
VOID LOOP ()
{
INT S = DIGITALREAD(INPUT);
IF (S == HIGH)
{
TIME -= 100;
}
5. FLOWCHARTS
Task1 Task2
6. BLOCK DIAGRAM
T
ASK1
TASK 2
7. PROCEDURES
1. I logged in to Tinkercad.
2. Created a new circuit.
3. I looked for the Arduino, LED, resistors and button.
4. I connected the electrical circuit and LEDs.
5. I wrote the special operating code for this experiment (what you want).
6. I ran the emulator
7. we ran the program and saw the results directly.