0% found this document useful (0 votes)
147 views4 pages

Proyek Ke-3 (Seven Segment) : - Tujuan 1. Membuat Proyek Dengan 7-Segment Dan Push Button

This document describes a project using a 7-segment display and push buttons. The project uses an Arduino Uno to control the 7-segment display. There are two push buttons, with one button counting up from 0 to 9 on the display and the other counting down from 9 to 0. The 7-segment display is cathode type. The code defines constants and variables for the push buttons and display pins. It then sets the pin modes and continuously reads the button states to determine which number to display.

Uploaded by

iin astari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views4 pages

Proyek Ke-3 (Seven Segment) : - Tujuan 1. Membuat Proyek Dengan 7-Segment Dan Push Button

This document describes a project using a 7-segment display and push buttons. The project uses an Arduino Uno to control the 7-segment display. There are two push buttons, with one button counting up from 0 to 9 on the display and the other counting down from 9 to 0. The 7-segment display is cathode type. The code defines constants and variables for the push buttons and display pins. It then sets the pin modes and continuously reads the button states to determine which number to display.

Uploaded by

iin astari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Adetia Lita Agustina Harahap Proyek ke-3 (seven segment)

13306141005
Fisika B13
PROYEK KE-3 (SEVEN SEGMENT)

- TUJUAN
1. Membuat proyek dengan 7-segment dan push button

- ALAT DAN BAHAN


1. Resistor (10k)
2. Push Button
3. Seven Segment
4. Kabel
5. Arduino-Uno
6. Project Board

- DESAIN ALAT
1. PCB
Adetia Lita Agustina Harahap Proyek ke-3 (seven segment)
13306141005
Fisika B13

2. Schematic

- PEMORAGRAMAN

// constants won't change. The


//y're used here to
// set pin numbers:
const int buttonPin = A5; // the number of the pushbutton pin
const int buttonPin1 = A4;
const int buttonPin2 = A3;

// variables will change:


int buttonState = 0; // variable for reading the pushbutton status
Adetia Lita Agustina Harahap Proyek ke-3 (seven segment)
13306141005
Fisika B13
int buttonState1 = 0;
int buttonState2 = 0;

int n,biner,k;
byte angka[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F
};

void setup() {
// initialize the LED pin as an output:
for (n=6; n <=13; n++)
pinMode(n,OUTPUT);

// initialize the pushbutton pin as an input:


pinMode(buttonPin,INPUT);
pinMode(buttonPin1,INPUT);
pinMode(buttonPin2,INPUT);

void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);

// check if the pushbutton is pressed.


// if it is, the buttonState is HIGH:
if (buttonState == LOW && buttonState1 == LOW && buttonState2==LOW) {
// turn LED on:
digitalWrite(13, 0);
digitalWrite(12,0);
digitalWrite(11, 0);
digitalWrite(10,0);
digitalWrite(9, 0);
digitalWrite(8, 0);
digitalWrite(7, 0);
digitalWrite(6, 0);
digitalWrite(5, 0);
digitalWrite(4, 0);
} else if (buttonState == HIGH && buttonState1 == LOW &&
buttonState2==LOW) {
// turn LED :
for(k=0; k<=9; k++){
Adetia Lita Agustina Harahap Proyek ke-3 (seven segment)
13306141005
Fisika B13
for(n=0; n<=13; n++){
biner=bitRead(angka[k],n);
digitalWrite(n+6,biner);
}delay(250);
}
}else if (buttonState == LOW && buttonState1 == HIGH && buttonState2==LOW)
{
for(k=9; k>=0; k--){
for(n=0; n<=13; n++){
biner=bitRead(angka[k],n);
digitalWrite(n+6,biner);
}delay(250);
}
}
}

- DISKUSI ILMIAH

Pada proyek ke-3 yaitu menggunakan seven segment, dengan kombinasi push button .
Dalam proyek kali ini push button yang digunakan ada 2. Posisi push button pertama
menyalakan seven segment dengan model up counter (0-9). Posisi push button kedua
dengan model down counter (9-0). Dalam proyek kali ini seven segment yang
digunakan adalah 7-segment tipe cathoda.

You might also like