Laporan Akhir 1




Percobaan 4

1. Prosedur
[Kembali]

1. Rangkai rangkaian di proteus sesuai dengan kondisi percobaan.
2. Tulis program untuk arduino di software Arduino IDE.
3. Compile program tadi, lalu upload ke dalam arduino.
4. Setelah program selesai di upload, jalankan simulasi rangkaian pada proteus.
5. Selesai

2. Hardware dan diagram blok [Kembali]
      1. Hardware



      2. Diagram Blok

3. Rangkaian Simulasi dan Prinsip kerja [Kembali]


PRINSIP KERJA
    Pada percobaan ini diminta untuk keypad 1 hingga 9 memberikan PWM 0-180 dengan jarak PWM antar key 20. Disini kita menggunakan keypad sebagai inputan dan output berupa motor servo yang dimana seperti yang diketahui motor servo itu bergerak secara presisi berdasakan sudutnya dengan menggunakan input berupa PWM nya. Percobaan kali ini kita akan mengatur sudut nya sesuai yang ada pada kondisi.

4. FlowChart [Kembali]

a. Listing Program 
#include <Servo.h>
#include <Keypad.h>
Servo servoMotor;

const int numRows = 4; // Number of rows in keypad
const int numCols = 3; // Number of columns in keypad
char keys[numRows][numCols] = {
 {'1', '2', '3'},
 {'4', '5', '6'},
 {'7', '8', '9'},
 {'*', '0', '#'}
};
byte rowPins[numRows] = {9, 8, 7, 6}; // Rows 0 to 3
byte colPins[numCols] = {5, 4, 3}; // Columns 0 to 2
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, numRows, numCols);
void setup() {
 servoMotor.attach(11);
 servoMotor.write(90); // Initial position
 Serial.begin(9600);
}
void loop() {
 char key = keypad.getKey();
 
 if (key != NO_KEY) {
 Serial.println(key);
 
 // Perform actions based on the key pressed
 switch (key) {
 case '1':
 // Move servo to position 0 degrees
 servoMotor.write(20);
 break;
 case '2':
 // Move servo to position 45 degrees
 servoMotor.write(40);
 break;
 case '3':
 // Move servo to position 90 degrees
 servoMotor.write(60);
 break;
 case '4':
 // Move servo to position 135 degrees
 servoMotor.write(80);
 break;
 case '5':
 // Move servo to position 180 degrees
 servoMotor.write(100);
 break;
 case '6':
 // Move servo to position 135 degrees
 servoMotor.write(120);
 break;
 case '7':
 // Move servo to position 90 degrees
 servoMotor.write(140);
 break;
 case '8':
 // Move servo to position 45 degrees
 servoMotor.write(160);
 break;
 case '9':
 // Move servo to position 0 degrees
 servoMotor.write(180);
 break;
 case '0':
 // Move servo to position 0 degrees
 servoMotor.write(0);
 break;
 case '*':
 // Move servo to position 0 degrees
 servoMotor.write(90);
 break;
 default:
 break;
 }
 }
}

b. Flowchart


5. Kondisi [Kembali]

Kondisi  : Percobaan 4 Sesuai modul

6. Video Simulasi [Kembali]


7. Download File [Kembali]
Download HTML Klik disini
Download Video Simulasi Klik disini
Download Listing Code Klik disini
Download Datasheet ARDUINO UNO Klik disini
Download Datasheet Motor Servo Klik disini
Download Datasheet Keypad 4x4 Klik Disini





















Tidak ada komentar:

Posting Komentar

                       BAHAN PRESENTASI UNTUK MATA KULIAH ELEKTRONIKA  2021/2022 Oleh : Fauzan Alfitrah 2110952002 Dosen Pengampu : Dr. Darw...