- Siswa dapat membuat rangkaian 7 segment di protoboard dengan baik.
- Siswa dapat membuat program dengan baik.
- Siswa dapat menjalankan 7 segment dengan baik.
- Komputer
- Arduino UNO
- 7 Segment
- Resistor
- Push button
- Kabel jumper
- Protoboard
- Membuat rangakian Counter up dan Counter down menggunakan seven segment
- Merangkai rangkaian di Protoboard
- Membuat Program di ARDUINO
- Mengecek Program
- Mengupload Program ke dalam ARDUINO UNO
- Hasil Program
int b=3;
int c=4;
int d=6;
int dp=5;
int e=7;
int f=8;
int g=9;
int btn1=13;
int btn2=12;
int counter=0;
int buttonUpState=0;
int lastButtonUpState=0;
int buttonDownState=0;
int lastButtonDownState=0;
void setup()
{
Serial.begin(9600);
pinMode(a,OUTPUT);
pinMode(b,OUTPUT);
pinMode(c,OUTPUT);
pinMode(d,OUTPUT);
pinMode(e,OUTPUT);
pinMode(f,OUTPUT);
pinMode(g,OUTPUT);
pinMode(dp,OUTPUT);
digitalWrite(dp,HIGH);
}
void loop()
{
buttonUpState=digitalRead(btn1);
buttonDownState=digitalRead(btn2);
if(buttonUpState!=lastButtonUpState)
{
if(buttonUpState==HIGH)
{
if(counter==9)
{
counter=-1;
}
counter++;
Serial.println(counter);
changeNumber(counter);
delay(300);
}
else
{
Serial.println("OFF");
}
delay(50);
}
if(buttonDownState!=lastButtonDownState)
{
if(buttonDownState==HIGH)
{
if(counter == 0)
{
counter = 10;
}
counter--;
Serial.println(counter);
changeNumber(counter);
delay(300);
}
else
{
Serial.println("OFF");
}
delay(50);
}
changeNumber(counter);
}
void changeNumber(int buttonPress)
{
switch (buttonPress)
{
//number 0
case 0:
digitalWrite(a,LOW);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,LOW);
digitalWrite(e,LOW);
digitalWrite(f,LOW);
digitalWrite(g,HIGH);
break;
//number 1
case 1:
digitalWrite(a,HIGH);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,HIGH);
digitalWrite(e,HIGH);
digitalWrite(f,HIGH);
digitalWrite(g,HIGH);
break;
//number 2
case 2:
digitalWrite(a,LOW);
digitalWrite(b,LOW);
digitalWrite(c,HIGH);
digitalWrite(d,LOW);
digitalWrite(e,LOW);
digitalWrite(f,HIGH);
digitalWrite(g,LOW);
break;
//number 3
case 3:
digitalWrite(a,LOW);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,LOW);
digitalWrite(e,HIGH);
digitalWrite(f,HIGH);
digitalWrite(g,LOW);
break;
//number 4
case 4:
digitalWrite(a,HIGH);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,HIGH);
digitalWrite(e,HIGH);
digitalWrite(f,LOW);
digitalWrite(g,LOW);
break;
//number 5
case 5:
digitalWrite(a,LOW);
digitalWrite(b,HIGH);
digitalWrite(c,LOW);
digitalWrite(d,LOW);
digitalWrite(e,HIGH);
digitalWrite(f,LOW);
digitalWrite(g,LOW);
break;
//number 6
case 6:
digitalWrite(a,LOW);
digitalWrite(b,HIGH);
digitalWrite(c,LOW);
digitalWrite(d,LOW);
digitalWrite(e,LOW);
digitalWrite(f,LOW);
digitalWrite(g,LOW);
break;
//number 7
case 7:
digitalWrite(a,LOW);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,HIGH);
digitalWrite(e,HIGH);
digitalWrite(f,HIGH);
digitalWrite(g,HIGH);
break;
//number 8
case 8:
digitalWrite(a,LOW);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,LOW);
digitalWrite(e,LOW);
digitalWrite(f,LOW);
digitalWrite(g,LOW);
break;
//number 9
case 9:
digitalWrite(a,LOW);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,LOW);
digitalWrite(e,HIGH);
digitalWrite(f,LOW);
digitalWrite(g,LOW);
break;
}
}
- Memakai Workpack
- Menaati peraturaan yang sudah ada
- Berkonsentrasi pada saat mengerjakan
- Tidak bercanda
Pada praktek kali saya dapat mempelajari tentang merangkai di protoboard dan membuat program seven segment counter up dan counter down di ARDUINO IDE dengan baik dan lancar
Klaten 8 Februari 2017
Guru Pendamping Peserta Didik
(Y. Prasetyo Adi N, ST) (Zakharias Kenang SH)