Tugas Pendahuluan Percobaan 1
1. Kondisi [ B A C K ]Percobaan 1 No.14
Kondisi awal LED mati lalu hidup secara bergantian led 1,2,3,4 selanjutnya 5,6,7,8 secara berulang
Kondisi awal LED mati lalu hidup secara bergantian led 1,2,3,4 selanjutnya 5,6,7,8 secara berulang
3. Video Simulasi [ B A C K ]
int led []= {2, 3, 4, 5, 6, 7, 8, 9};
void setup() {
for (int i=0; i<=8; i++)
{
pinMode (led[i], OUTPUT);
}
}
void loop() {
for (int hidup = 0; hidup<=3; hidup++){
digitalWrite(led[hidup], HIGH);
delay(100);
}
delay(100);
for (int mati=0; mati<=3; mati++){
digitalWrite(led[mati], LOW);
delay(100);
}
delay(100);
for (int hidup=4; hidup<=8; hidup++){
digitalWrite(led[hidup], HIGH);
delay(100);
}
delay(100);
for(int mati=4; mati<=8; mati++){
digitalWrite(led[mati], LOW);
delay(100);
}
delay(100);
}
void setup() {
for (int i=0; i<=8; i++)
{
pinMode (led[i], OUTPUT);
}
}
void loop() {
for (int hidup = 0; hidup<=3; hidup++){
digitalWrite(led[hidup], HIGH);
delay(100);
}
delay(100);
for (int mati=0; mati<=3; mati++){
digitalWrite(led[mati], LOW);
delay(100);
}
delay(100);
for (int hidup=4; hidup<=8; hidup++){
digitalWrite(led[hidup], HIGH);
delay(100);
}
delay(100);
for(int mati=4; mati<=8; mati++){
digitalWrite(led[mati], LOW);
delay(100);
}
delay(100);
}
5. Flowchart [ B A C K ]
Listing Program Download
Tidak ada komentar:
Posting Komentar