Anda di halaman 1dari 4

UNIVERSITI TEKNOLOGI MARA

FAKULTI KEJURUTERAAN MEKANIKAL

Arduino Experiment: Blinking LED

2016218554 Nor Aqilah Binti Mohd Shafie

2016218408 Nurul ‘Aina Nazihah Binti Nazmi

MEC523 Applied Electronics and Microprocessor

EMD6M1A

EM220

Bachelor of Mechanical Engineering (Hons)

Faculty of Mechanical Engineering

Dr. Abdul Malek Abdul Wahab

Faculty of Mechanical Engineering

Universiti Teknologi MARA (UiTM) Shah Alam

April 2019
INTRODUCTION

This session will start off with simple experiment which is blinking LED repeatedly. Firstly,
the circuit is assembled with LED, wires, and 220 Ohm Resistor. Then, the program will be
uploaded to tell Arduino what to do.

OBJECTIVES

To imitate how traffic lights, blink repeatedly. The system is portrayed by 3 LED which, each
LED possess specific delay time.

To observe the manipulation of delay time on LED blinking.

EXPERIMENTAL PROCEDURE

Coding

2
Flowchart

Start

Initialize LED pin 8, 9, 10

Turn LED on Yes


Pin 8

Wait 0.5s No

Turn LED off

Wait 0.5s

Turn LED on Yes


Pin 9

Wait 1s No

Turn LED off

Wait 1s

Turn LED on Yes


Pin 10

Wait 2s No

Turn LED off

Wait 2s

3
Figure shows the circuit setup

DISCUSSION
This is one of the fundamental Arduino examples where the built-in system has default of
turning 13 pin LED on and off with a second interval within. However, for improvisation, 3
LED are used instead of 1 LED to observe alternate blinking. The yellow, red, and green LED
are plugged at pin 8, 9, and 10 respectively. The declaration is placed in void setup( ) function
by pinMode(LEDPIN, OUTPUT) which means the declared LED will carry out everything
propose to them. In void loop( ), the instructions are given by digitalWrite(LEDPIN, HIGH).
This command specify what the LED will do either on or off by HIGH or LOW. HIGH means
high voltage will pass through thus turn the pin on and the other way for LOW. ON and OFF
can also being used besides HIGH and LOW. Next, delay time of the 3 LED can also be
manipulated in sequence. Delay time system used in Arduino is millisecond i.e. “delay(1000)”
where the microcontroller will delay the voltage for 1 second. The blinking will forever be in
loop unless the circuit is open. At this point of the code, it can be comprehended that an
instruction in software makes something happen in the physical world by controlling the flow
of electricity to the pin.

Anda mungkin juga menyukai