Tampilkan angka 0, 1, 3, 5 secara bergantian
Gambar rangkaian
Gambar rangkaian saat disimulasikan
3. Listing Program
[kembali]Teori
void setup() {
pinMode(13, OUTPUT); // Kaki 13 menunjukan ke pin A 7segment
pinMode(12, OUTPUT); // Kaki 12 menunjukan ke pin B 7segment
pinMode(11, OUTPUT); // Kaki 11 menunjukan ke pin C 7segment
pinMode(10, OUTPUT); // Kaki 10 menunjukan ke pin D 7segment
pinMode(9, OUTPUT); // Kaki 9 menunjukan ke pin E 7segment
pinMode(8, OUTPUT); // Kaki 8 menunjukan ke pin F 7segment
pinMode(7, OUTPUT); // Kaki 7 menunjukan ke pin G 7segment
}
void loop() {
// tampilan angka '0'
digitalWrite(13, 1);
digitalWrite(12, 1);
digitalWrite(11, 1);
digitalWrite(10, 1);
digitalWrite(9, 1);
digitalWrite(8, 1);
digitalWrite(7, 0);
delay(1000);
// tampilan angka '1'
digitalWrite(13, 0);
digitalWrite(12, 1);
digitalWrite(11, 1);
digitalWrite(10, 0);
digitalWrite(9, 0);
digitalWrite(8, 0);
digitalWrite(7, 0);
delay(1000);
// tampilan angka '3'
digitalWrite(13, 1);
digitalWrite(12, 1);
digitalWrite(11, 1);
digitalWrite(10, 1);
digitalWrite(9, 0);
digitalWrite(8, 0);
digitalWrite(7, 1);
delay(1000);
// tampila angka '5'
digitalWrite(13, 1);
digitalWrite(12, 0);
digitalWrite(11, 1);
digitalWrite(10, 1);
digitalWrite(9, 0);
digitalWrite(8, 1);
digitalWrite(7, 1);
delay(1000);
}
Tidak ada komentar:
Posting Komentar