1.
Microcontroller
i. Arduino Duemilanov ATMega 328 (1 buah)
2.
Resistor
3.
Seven
Segment
i.
7
Segment Anode (1 buah)
i.
Kabel
Pelangi (Secukupnya)
void setup(){
for(int
i=0;i<7;i++){
pinMode(i,OUTPUT);
}
}
void
tampil(byte a1, byte a2, byte a3, byte a4, byte a5, byte a6, byte a7){
digitalWrite(0,a1);
digitalWrite(1,a2);
digitalWrite(2,a3);
digitalWrite(3,a4);
digitalWrite(4,a5);
digitalWrite(5,a6);
digitalWrite(6,a7);
}
void loop(){
tampil(0,0,0,1,0,0,0);
delay(500);
tampil(1,0,0,1,0,0,0);
delay(500);
tampil(1,0,0,0,0,0,1);
delay(500);
tampil(1,1,1,1,1,1,1);
delay(500);
tampil(0,0,0,0,0,0,0);
delay(500);
tampil(1,1,1,1,0,0,1);
delay(500);
tampil(0,1,0,0,1,0,0);
delay(500);
tampil(0,0,0,1,0,0,0);
delay(500);
tampil(1,1,1,1,1,1,1);
delay(500);
}
interfacing arduino via vb gimana mas untk updown counternya trimaksih
ReplyDelete