Sunteți pe pagina 1din 10

LAPORAN PRAKTIKUM

SISTEM MIKROKONTROLER ARDUINO


RUNNING LED

Disusun Oleh :
Afunia Bundha Lasera (11201806406)
Dewi Bilqis Mariska (11201806539)
Marisca Putri (11201800284)

PROGRAM PENDIDIKAN PROFESI GURU (PPG) PRA JABATAN


Bidang Teknik Elektronika Fakultas Teknik Universitas Negeri Jakarta
2018
A. ALAT DAN BAHAN
- Arduino Uno
- Bread Board
- Kabel jumper
- Resistor 220 (6 buah)
- LED (6 buah)

B. SKEMATIK DIAGRAM
Rangkaian

Gambar A. Skematik rangkaian percobaan


C. FLOW CHART

START

Delay (timer) = 500ms


Pin = {2,3,4,5,6,7}
Num_Pin = 6
Int i
Pin [i], Output

For(i=0)

No
(i < 6)

Yes i = 6-1

i++ i>=0

i--

Led ON

Delay 500ms

Led OFF

END

Gambar 1. Flow chart Running LED Percobaan 1


D. PROGRAM
int timer = 500;
int pins [] = {2, 3, 4, 5, 6, 7};
int num_pins = 6;
void setup()
{
// put your setup code here, to run once:
int i;
for (i=0; i < num_pins ; i++){
pinMode (pins[i], OUTPUT);
}
}

void loop()
{
int i;
for (i=0; i< num_pins; i++){
digitalWrite (pins [i], HIGH);
delay (timer);
digitalWrite (pins [i], LOW);
}
for (i=num_pins - 1; i>= 0; i--){
digitalWrite (pins [i],HIGH);
delay (timer);
digitalWrite (pins [i], LOW);
}
}
E. HASIL DAN PEMBAHASAN

Led berjalan beraturan secara berulang dari pin 2, 3, 4, 5, 6, 7 dan kembali secara berurutan
dari pin 7 ke pin 2, dengan waktu 500 ms.
1. Percobaan Modifikasi ke-1 Mengganti nilai delay dari 500 ms menjadi 1000 ms.

START

Delay (timer) = 1000ms


Pin = {2,3,4,5,6,7}
Num_Pin = 6
Int i
Pin [i], Output

For(i=0)

No
(i < 6)

Yes i = 6-1

i++ i>=0

i--

Led ON

Delay 1000ms

Led OFF

END

Gambar 2. Flow chart Running LED Percobaan 2

Program :
int timer = 1000;
int pins [] = {2, 3, 4, 5, 6, 7};
int num_pins = 6;
void setup()
{
// put your setup code here, to run once:
int i;
for (i=0; i < num_pins ; i++){
pinMode (pins[i], OUTPUT);
}
}

void loop()
{
int i;
for (i=0; i< num_pins; i++){
digitalWrite (pins [i], HIGH);
delay (timer);
digitalWrite (pins [i], LOW);
}
for (i=num_pins - 1; i>= 0; i--){
digitalWrite (pins [i],HIGH);
delay (timer);
digitalWrite (pins [i], LOW);
}
}
2. Percobaan modifikasi ke-2, mengganti urutan nyala LED secara berselang-seling (tidak
beraturan) yakni dari pin 3, 5, 7, 2, 4, 6.

START

Delay (timer) = 500ms


Pin = {3, 5, 7, 2, 4, 6}
Num_Pin = 6
Int i
Pin [i], Output

For(i=0)

No
(i < 6)

Yes i = 6-1

i++ i>=0

i--

Led ON

Delay 500ms

Led OFF

END

Gambar 2. Flow chart Running LED Percobaan 3


Program:
int timer = 500;
int pins [] = {3, 5, 7, 2, 4, 6};
int num_pins = 6;
void setup()
{
// put your setup code here, to run once:
int i;
for (i=0; i < num_pins ; i++){
pinMode (pins[i], OUTPUT);
}
}

void loop()
{
int i;
for (i=0; i< num_pins; i++){
digitalWrite (pins [i], HIGH);
delay (timer);
digitalWrite (pins [i], LOW);
}
for (i=num_pins - 1; i>= 0; i--){
digitalWrite (pins [i],HIGH);
delay (timer);
digitalWrite (pins [i], LOW);
}
}
3. Percobaan modifikasi ke-3, menyalakan 2 buah led secara bersamaan dalam kondisi running.

START

Delay (timer) = 500ms


Pin = {2,3,4,5,6,7}
Num_Pin = 6
Int i
Pin [i], Output

For(i=0)

No
(i < 6)

Yes i = 6-1

i++ i>=0

i--

Led ON (2 Pc)

Delay 500ms

Led OFF (2 Pc)

END

Gambar 3. Flow chart Running LED Percobaan 4


int timer = 500;
int pins [] = {2,3,4,5,6,7};
int num_pins = 6;
void setup()
{
// put your setup code here, to run once:
int i;
for (i=0; i < num_pins ; i++){
pinMode (pins[i], OUTPUT);
}
}

void loop()
{
int i;
for (i=0; i< num_pins; i++){
digitalWrite (pins [i+1], HIGH);
delay (timer);
digitalWrite (pins [i], LOW);
digitalWrite (pins [i+1], LOW);
}
for (i=num_pins - 1; i>= 0; i--){
digitalWrite (pins [i-1],HIGH);
digitalWrite (pins [i],HIGH);
delay (timer);
digitalWrite (pins [i-1], LOW);
digitalWrite (pins [i], LOW)
}
}

F. KESIMPULAN
Pada praktikum ini kita dapat mengendalikan tampilan on off LED dengan menggunakan
kendali dari Arduino UNO.

S-ar putea să vă placă și