0% found this document useful (0 votes)
90 views

Interfacing Joystick Dengan Arduino

This document describes connecting a joystick module to an Arduino UNO board to read the X and Y positional data from the joystick and display it on an LCD screen. It includes the hardware requirements, block diagram, wiring schematics, Arduino code, and an explanation of how it works. Pushing the joystick button will toggle an on-board LED on the Arduino board.

Uploaded by

Eka Kusyanto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

Interfacing Joystick Dengan Arduino

This document describes connecting a joystick module to an Arduino UNO board to read the X and Y positional data from the joystick and display it on an LCD screen. It includes the hardware requirements, block diagram, wiring schematics, Arduino code, and an explanation of how it works. Pushing the joystick button will toggle an on-board LED on the Arduino board.

Uploaded by

Eka Kusyanto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1 Inkubatek [supported by : www.tokotronik.

com]

Interfacing Joystick dengan Arduino


Sistem Kerja Alat:
Arduin0o UNO membaca data output X dan Y dari joystick yang hasilnya ditampilkan pada
LCD.

Kebutuhan Hardware :
 Modul Joystick
 Modul LCD 2x16
 Modul Arduino UNO
 Power supply +9Volt

INKUBATEK

Joystick

Diagram Blok:

Modul Joystick Arduino UNO LCD 2X16

Schematics
2 Inkubatek [supported by : www.tokotronik.com]

Koneksi Arduino UNO dengan LCD:


Pin ARDUINO LCD

2 RS
3 EN
4 D4
5 D5
3 Inkubatek [supported by : www.tokotronik.com]

6 D6
7 D7

Koneksi Modul Joystick:


Pin Modul Joystick Pin ARDUINO

GND GND
+5V 5V
VRX A0
VRY A1
SW 8

Source Code/Sketch :
/*************************************
* Program : Project 31. Interfacing Joystick dg Arduino
* Input : Sensor Joystick
* 125 Proyek Arduino Inkubatek
* www.tokotronik.com
* ***********************************/
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int joyX = A0;
int joyY = A1;
int value1 = 0;
int value2 = 0;
int SW = 8;
int led = 0;

void setup() {
pinMode(13, OUTPUT);
pinMode(SW, INPUT);
digitalWrite(SW, HIGH);
lcd.begin(16, 2);
lcd.print("Baca Joystick");
}

void loop() {
value1 = analogRead(joyX);
value2 = analogRead(joyY);
4 Inkubatek [supported by : www.tokotronik.com]

lcd.setCursor(0 ,1);
//X=46 --> 1018
lcd.print("X:");
lcd.print(value1);
//Y=46 --> 1018
lcd.print(" Y:");
lcd.print(value2);
lcd.print(" ");
if(digitalRead(SW)==0){
delay(100);
led=!led;
digitalWrite(13, led);
}
delay(100);
}

Jalannya Alat :
LCD menampilkan nilai X dan Y, sedangkan tombol/SW akan menghidupkan dan mematikan
LED 13 Arduino.

[Uji coba memakai hardware “Master Mikro ARDUINO V2” :


http://tokotronik.com/master-mikro-arduino-v2/ ]

You might also like