[KEMBALI KE MENU SEBELUMNYA]
1. Hardware [back]
2. Rangkaian Simulasi
[back]3. Listring Program dan Flowchart [back]
byte pin[] = {2, 3, 4, 5, 6, 7, 8, 9};
void setup()
{ for (int i = 0; i < 9; i++)
{
pinMode(pin[i], OUTPUT);
}
}
void loop()
{
digitalWrite(2, HIGH);//1
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
delay(800);
digitalWrite(2, LOW);//2
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
delay(800);
digitalWrite(2, LOW);//3
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
delay(800);
digitalWrite(2, LOW);//4
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
delay(800);
digitalWrite(2, LOW);//5
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
delay(800);
digitalWrite(2, LOW);//6
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
delay(800);
digitalWrite(2, HIGH);//7
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
delay(800);
digitalWrite(2, LOW);//8
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
delay(800);
digitalWrite(2, LOW);//9
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
delay(800);
}
- Menampilkan secara bergantian dari angka 1-9
Prinsip Kerja Rangkaian
Pin 2 : DP
Pin 3: g
Pin 4 : f
Pin 5: e
pin 6 : d
Pin 7 :
Pin 8 : b
Pin 9 : a
Pada Percobaan, Rangkaian dirangkai sesuai dengan kondisi yang diminta, yaitu untuk menampilkan angka 1-9 secara berurut. Kaki-kaki pada pin seluruh Arduino di 7 Segment Setelah pin terhubung, maka selanjutnya rangkaian program, maka pada 7 Segmen akan menunjukkan angka 1-9 secara berurutn sesuai dengan perintah.
1. 6. Analisa [back]
Percobaan 2 Kondisi 2
1. Jelaskan perbedaan program yang digunakan saat menggunakan seven segment tipe common anoda dan tipe common katoda
Jawab:
- common anoda (kaki anoda menjadi 1 pinbertegangan positif)
- common katoda (kaki katoda menjadi 1 pin bertegangan negatif)
saat menggunakan seven segment common anoda, program output pada setiap pin harus low(0) sedangkan pada common katoda program output pada setiap pin digital pada arduino harus high(1)
Tidak ada komentar:
Posting Komentar