percobaan 2 kondisi 2
Tampilkan angka dari 1 sampai 9 secara berulang
2. Gambar Rangkaian Simulasi
[Kembali]
program
byte pin[]={2,3,4,5,6,7,8,9};
void setup() {
// put your setup code here, to run once:
for (int i =0; i<9; i++)
{
pinMode(pin[i], OUTPUT);
}
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
delay(1000);
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
delay(1000);
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
delay(1000);
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
delay(1000);
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,LOW);
digitalWrite(9,HIGH);
delay(1000);
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,LOW);
digitalWrite(9,HIGH);
delay(1000);
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
delay(1000);
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
delay(1000);
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
delay(1000);
}
3. Video Simulasi
[Kembali]
4. Prinsip Kerja Rangkaian
[Kembali]
pada rangkaian pin digital terhubung dengan seven segment dimana A=2, B=3, C=4, D=5, E=6, F=7, G=9. hubungan antara pin dan 7 segment memberikan lokasi lampu yang menyala pada 7 segment. sehingga arduino dapat diprogram untuk menghitpak angka 1 hingga 9 secara berutanan dengan cara memprogram bagian hidup dari 7 segment sesuai dengan angka yang di tampilkan. misalnya untuk angka satu maka bagian yang harus dihidupka pada seven segment adalah B,C. sehingga pada program pin 3 dan 4 diberikan perintah digitalWrite dengan kondisi HIGH sehingga terbentuk angka satu pada 7 segment dan begitu seterusnya.
5. Link Download
[Kembali]
Tidak ada komentar:
Posting Komentar