SMK PL LEONARDO KLATEN
MENYALAKAN 7 SEGMENT MELALUI SERIAL MONITOR
TUJUAN :
1. Agar siswa dapat mencoba menggunakan arduino uno dengan berbagai rangkaian.
2. Siswa dapat merangkai rangkaian serial kontrol .
3. Siswa dapat mempelajari cara memebuat program sendiri dalam aplikasi arduino.
4. Siswa dapat lebih mengetahui fungsi, cara kerja dari arduino uno.
5. Siswa dapat membaca secara benar program-program yang telah tertulis maupun yang telah
ditulis pada lembar kerja arduino.
6. Siswa dapat menggunakan versi lain ( if, if else, dan dapat menambahkan void tersendiri).
7. siswa dapat merangkai rangkaian 7 segment.
8. siswa dapat mengetahui cara kerja dari 7 segment.
9. Siswa dapat mencoba serial control pada 7segment
BAHAN:
1. laptop / komputer
2. aplikasi arduino
3. board arduino
4. protoboard
5. resistor 330 (3)
8. connector ( kabel male) secukupnya
9. multitester
10. kabel USB
11. 7 segment (1)
MATERI SINGKAT :
Dalam pembahasan kali ini kita akan membahas tentang pengaplikasian arduino dalam sebuah rangkaian yang
akan dibuat. Kita akan mencoba untuk membat rangkaian 7 segment, kemudian 7 segment akan diprogramkan menjadi
serial kontrol. maka apabila serial monitor kita buka,kita mengetikkan kode dari program yang telah kita buat pada serial monitor
7segment akan memunculkan angka atau huruf sesuai program yang tertulis. kita juga membuat programnya sendiri
sesuai aturan aturan yang ada dan menggunakan if / if else.
DESKRIPSI TUGAS
1. membuat 7segment melalui serial monitor.
2. membuat 7 segment karakter huruf melalui serial monitor.
KESELAMATAN KERJA :
1. saat akan mengaplikasikan arduino dengan board arduino, jangan langsung ke board
arduino melainkan dibantu dengan protoboard
2. saat mencoba board arduino, jangan sampao board tersebut menyentuh besi.
3. saat ingin mengubah rangkaian pada protoboard, maka USB harus dilepas terlebih dahulu.
4. pastikan bahwa driver arduino telah terinstall dan port USB sudah terdriver oleh arduino.
5. apabila hanya ingin mengecek program maka klik verify.
6. apabila ingin memasukkan data pada board arduino maka klik upload.
7. teliti pada saat penulisan kalimat pemrograman.
CARA KERJA :
1. siapkan alat dan bahan yang dibutuhkan.
2. rangkailah rangkaian 7 segment.
3. buat program 7 segment dengan format program yang benar.
4. program yang dibuat adalah 7 segment karakter angka dan karakter huruf dalam satu lembar program.
Program Arduino:
int A = 4;
int B = 2;
int C = 9;
int D = 7;
int DP =8;
int E = 11;
int F = 5;
int G = 12;
int baca;
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);
Serial.flush();
}
void loop()
{
int baca= Serial.read ();
if (baca=='a')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, HIGH);
Serial.println ('0');
delay (1000);
}
if (baca=='b')
{
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(G, HIGH);
digitalWrite(A, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, HIGH);
digitalWrite(F, HIGH);
digitalWrite(G, HIGH);
Serial.println ('1');
delay(1000);
}
if (baca=='c')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(G, LOW);
digitalWrite(C, HIGH);
digitalWrite(F, HIGH);
Serial.println ('2');
delay(1000);
}
if (baca=='d')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(G, LOW);
digitalWrite(E, HIGH);
digitalWrite(F, HIGH);
Serial.println ('3');
delay(1000);
}
if (baca=='e')
{
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
digitalWrite(A, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, HIGH);
Serial.println ('4');
delay(1000);
}
if (baca=='f')
{
digitalWrite(A, LOW);
digitalWrite(C, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
digitalWrite(B, HIGH);
digitalWrite(D, LOW);
digitalWrite(E, HIGH);
Serial.println ('5');
delay(1000);
}
if (baca=='g')
{
digitalWrite(A, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
digitalWrite(B, HIGH);
Serial.println ('6');
delay(1000);
}
if (baca=='h')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, HIGH);
digitalWrite(E, HIGH);
digitalWrite(F, HIGH);
digitalWrite(G, HIGH);
Serial.println ('7');
delay(1000);
}
if(baca=='i')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('8');
delay(1000);
}
if(baca=='j')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
digitalWrite(E, HIGH);
Serial.println ('9');
delay(1000);
}
if (baca=='1')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, HIGH);
digitalWrite(G, LOW);
Serial.println ('a');
delay (1000);
}
if (baca=='2')
{
digitalWrite(A, HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('b');
delay (1000);
}
if (baca=='3')
{
digitalWrite(A, LOW);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, HIGH);
Serial.println ('c');
delay (1000);
}
if (baca=='4')
{
digitalWrite(A, HIGH);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, HIGH);
digitalWrite(G, LOW);
Serial.println ('d');
delay (1000);
}
if (baca=='5')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, HIGH);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('e');
delay (1000);
}
if (baca=='6')
{
digitalWrite(A, LOW);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('f');
delay (1000);
}
if (baca=='7')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, HIGH);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('g');
delay (1000);
}
if (baca=='8')
{
digitalWrite(A, HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, LOW);
digitalWrite(D, HIGH);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('h');
delay (1000);
}
if (baca=='9')
{
digitalWrite(A, HIGH);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, HIGH);
digitalWrite(E, HIGH);
digitalWrite(F, HIGH);
digitalWrite(G, HIGH);
Serial.println ('i');
delay (1000);
}
if (baca=='k')
{
digitalWrite(A, HIGH);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, HIGH);
digitalWrite(G, HIGH);
Serial.println ('J');
delay (1000);
}
if (baca=='11')
{
digitalWrite(A, HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, HIGH);
Serial.println ("L");
delay (1000);
}
if (baca=='l')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, HIGH);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('n');
delay (1000);
}
if (baca=='m')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('o');
delay (1000);
}
if (baca=='n')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, HIGH);
digitalWrite(D, HIGH);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('P');
delay (1000);
}
if (baca=='o')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, HIGH);
digitalWrite(E, HIGH);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('q');
delay (1000);
}
if (baca=='p')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, HIGH);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('R');
delay (1000);
}
if (baca=='q')
{
digitalWrite(A, LOW);
digitalWrite(B, HIGH);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, HIGH);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('S');
delay (1000);
}
if (baca=='r')
{
digitalWrite(A, HIGH);
digitalWrite(B, HIGH);
digitalWrite(C, HIGH);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('t');
delay (1000);
}
if (baca=='s')
{
digitalWrite(A, HIGH);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, LOW);
digitalWrite(G, HIGH);
Serial.println ('U');
delay (1000);
}
if (baca=='t')
{
digitalWrite(A, HIGH);
digitalWrite(B, LOW);
digitalWrite(C, LOW);
digitalWrite(D, LOW);
digitalWrite(E, HIGH);
digitalWrite(F, LOW);
digitalWrite(G, LOW);
Serial.println ('y');
delay (1000);
}
if (baca=='u')
{
digitalWrite(A, LOW);
digitalWrite(B, LOW);
digitalWrite(C, HIGH);
digitalWrite(D, LOW);
digitalWrite(E, LOW);
digitalWrite(F, HIGH);
digitalWrite(G, LOW);
Serial.println ('z');
delay (1000);
}
}
HASIL:
Pembimbing Pembimbing Klaten, 13 Maret 2017
( F.Nanda ) ( Y. Prasetya ) (Elisabenth Novoita Dewi)