Laporan Akhir 2 Modul I uP&uC
1. Komponen [KEMBALI]
Sevent segment
Arduino Power Supply
2. Rangkaian Simulasi [KEMBALI]
3. Flowchart [KEMBALI]
4. Listing Program [KEMBALI]byte pin[] = {2, 3, 4, 5, 6, 7, 8, 9}; //Deklarasi pin yang digunakan pada 7-segment dengan tipe data bytevoid setup() //Semua kode dalam fungsi ini hanya dieksekusi sekali{ for (int i = 0; i < 9; i++) //Kondisi perulangan dari 0 hingga batas kecil dari 9; Increase{pinMode(pin[i], OUTPUT); //Deklarasi pin yang digunakan sebagai OUTPUT}}void loop() //Semua kode dalam fungsi ini di eksekusi berulang{digitalWrite(2, LOW);digitalWrite(3, HIGH); digitalWrite(4, HIGH); digitalWrite(5, HIGH); digitalWrite(6, HIGH); digitalWrite(7, LOW);digitalWrite(8, LOW);digitalWrite(9, HIGH);
delay (1000);
digitalWrite(2, LOW);digitalWrite(3, LOW); digitalWrite(4, HIGH); digitalWrite(5, LOW); digitalWrite(6, LOW); digitalWrite(7, HIGH);digitalWrite(8, LOW);digitalWrite(9, LOW);
delay (1000);
digitalWrite(2, LOW);digitalWrite(3, LOW); digitalWrite(4, HIGH); digitalWrite(5, HIGH); digitalWrite(6, LOW); digitalWrite(7, LOW);digitalWrite(8, LOW);digitalWrite(9, LOW);
delay (1000);
digitalWrite(2, LOW);digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, HIGH); digitalWrite(6, HIGH); digitalWrite(7, LOW);digitalWrite(8, LOW);digitalWrite(9, HIGH);
delay (1000);
digitalWrite(2, LOW);digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, HIGH); digitalWrite(6, LOW); digitalWrite(7, LOW);ddigitalWrite(8, HIGH);digitalWrite(9, LOW);
delay (1000);}
5. Video [KEMBALI]
6. Analisa [KEMBALI]
1. Mengapa angka tersebut dapat muncul secara bergantian
Jawab :
Angka bisa muncul secara bergantian dikarenakan pada pemrogaman pada arduino ditambahkan delay sebesar 1000ms. Yang mengakibatkan angka muncul secara bergantian dengan jeda waktu 1000ms.
2. Kenapa Sevent segmen menggunakan pin digital
Jawab :
Karna pada LED 7-segment hanya menerima input berupa logika High (1) atau Low (0). Sehingga kita harus menggunakan pin digital, karna pin digital dapat memberikan logika biner tersebut.
3. Analisa Program Kenapa bisa muncul angka 1-5
Jawab:
[1] byte pin[] = {2, 3, 4, 5, 6, 7, 8, 9}; //Deklarasi pin yang digunakan pada 7-segment dengan tipe data byte
[2] void setup() //Semua kode dalam fungsi ini hanya dieksekusi sekali
[3] { for (int i = 0; i < 9; i++) //Kondisi perulangan dari 0 hingga batas kecil dari 9; Increase
[4] {
[5] pinMode(pin[i], OUTPUT); //Deklarasi pin yang digunakan sebagai OUTPUT
[6] }
[7] }
[8] void loop() //Semua kode dalam fungsi ini di eksekusi berulang
[9] {
[10] digitalWrite(2, LOW); // pin yang berlogika low akan menyala
[11] digitalWrite(3, HIGH); // menampilkan angka 1
[12] digitalWrite(4, HIGH);
[13] digitalWrite(5, HIGH);
[14] digitalWrite(6, HIGH);
[15] digitalWrite(7, LOW);
[16] digitalWrite(8, LOW);
[17] digitalWrite(9, HIGH);
[18] delay (1000);// memberi delay / jeda selama 1000 ms
[19] digitalWrite(2, LOW);// menampilkan angka 2
[20] digitalWrite(3, LOW);
[21] digitalWrite(4, HIGH);
[22] digitalWrite(5, LOW);
[23] digitalWrite(6, LOW);
[24] digitalWrite(7, HIGH);
[25] digitalWrite(8, LOW);
[26] digitalWrite(9, LOW);
[27] delay (1000);
[28] digitalWrite(2, LOW);// menampilkan angka 3
[29] digitalWrite(3, LOW);
[30] digitalWrite(4, HIGH);
[31] digitalWrite(5, HIGH);
[32] digitalWrite(6, LOW);
[33] digitalWrite(7, LOW);
[34] digitalWrite(8, LOW);
[35] digitalWrite(9, LOW);
[36] delay (1000);
[37] digitalWrite(2, LOW);//menampilkan angka 4
[38] digitalWrite(3, LOW);
[39] digitalWrite(4, LOW);
[40] digitalWrite(5, HIGH);
[41] digitalWrite(6, HIGH);
[42] digitalWrite(7, LOW);
[43] digitalWrite(8, LOW);
[44] digitalWrite(9, HIGH);
[45] delay (1000);
[46] digitalWrite(2, LOW);// menampilkan angka 5
[47] digitalWrite(3, LOW);
[48] digitalWrite(4, LOW);
[49] digitalWrite(5, HIGH);
[50] digitalWrite(6, LOW);
[51] digitalWrite(7, LOW);
[52] digitalWrite(8, HIGH);
[53] digitalWrite(9, LOW);
[54] delay (1000);
[55] }
7. Link Download [KEMBALI]
Video Simulasi DownloadListing Program DownloadFlowchart DownloadFile Html Download
2. Rangkaian Simulasi [KEMBALI]
1. Mengapa angka tersebut dapat muncul secara bergantian
Jawab :
Angka bisa muncul secara bergantian dikarenakan pada pemrogaman pada arduino ditambahkan delay sebesar 1000ms. Yang mengakibatkan angka muncul secara bergantian dengan jeda waktu 1000ms.
2. Kenapa Sevent segmen menggunakan pin digital
Jawab :
Karna pada LED 7-segment hanya menerima input berupa logika High (1) atau Low (0). Sehingga kita harus menggunakan pin digital, karna pin digital dapat memberikan logika biner tersebut.
3. Analisa Program Kenapa bisa muncul angka 1-5
Jawab:
[1] byte pin[] = {2, 3, 4, 5, 6, 7, 8, 9}; //Deklarasi pin yang digunakan pada 7-segment dengan tipe data byte
[2] void setup() //Semua kode dalam fungsi ini hanya dieksekusi sekali
[3] { for (int i = 0; i < 9; i++) //Kondisi perulangan dari 0 hingga batas kecil dari 9; Increase
[4] {
[5] pinMode(pin[i], OUTPUT); //Deklarasi pin yang digunakan sebagai OUTPUT
[6] }
[7] }
[8] void loop() //Semua kode dalam fungsi ini di eksekusi berulang
[9] {
[10] digitalWrite(2, LOW); // pin yang berlogika low akan menyala
[11] digitalWrite(3, HIGH); // menampilkan angka 1
[12] digitalWrite(4, HIGH);
[13] digitalWrite(5, HIGH);
[14] digitalWrite(6, HIGH);
[15] digitalWrite(7, LOW);
[16] digitalWrite(8, LOW);
[17] digitalWrite(9, HIGH);
[18] delay (1000);// memberi delay / jeda selama 1000 ms
[19] digitalWrite(2, LOW);// menampilkan angka 2
[20] digitalWrite(3, LOW);
[21] digitalWrite(4, HIGH);
[22] digitalWrite(5, LOW);
[23] digitalWrite(6, LOW);
[24] digitalWrite(7, HIGH);
[25] digitalWrite(8, LOW);
[26] digitalWrite(9, LOW);
[27] delay (1000);
[28] digitalWrite(2, LOW);// menampilkan angka 3
[29] digitalWrite(3, LOW);
[30] digitalWrite(4, HIGH);
[31] digitalWrite(5, HIGH);
[32] digitalWrite(6, LOW);
[33] digitalWrite(7, LOW);
[34] digitalWrite(8, LOW);
[35] digitalWrite(9, LOW);
[36] delay (1000);
[37] digitalWrite(2, LOW);//menampilkan angka 4
[38] digitalWrite(3, LOW);
[39] digitalWrite(4, LOW);
[40] digitalWrite(5, HIGH);
[41] digitalWrite(6, HIGH);
[42] digitalWrite(7, LOW);
[43] digitalWrite(8, LOW);
[44] digitalWrite(9, HIGH);
[45] delay (1000);
[46] digitalWrite(2, LOW);// menampilkan angka 5
[47] digitalWrite(3, LOW);
[48] digitalWrite(4, LOW);
[49] digitalWrite(5, HIGH);
[50] digitalWrite(6, LOW);
[51] digitalWrite(7, LOW);
[52] digitalWrite(8, HIGH);
[53] digitalWrite(9, LOW);
[54] delay (1000);
[55] }
Tidak ada komentar:
Posting Komentar