# JOYSTICK SKU:U024
## Description **JOYSTICK**, M5Stack has two types of JOYSTICKs: one is compatible with FACES Kit and this one, which is a M5Unit version of ther other **JOYSTICK** device. JOYSTICK is very similar to the 'analog' joystick on PS2 (PlayStation 2) controllers. The X and Y axes are two 10k potentiometers which control 2D movement by generating analog signals. The joystick also has a push button that could be used for special applications. Therefore, the entire Unit can output X-Y motion signals in both directions and Z direction. Based on the schematic, the Joystick X dimension is connected to pin A0 of MEGA328, the Joystick Y dimension is connected to pin A1 on MEGA328, the Joystick Z dimension is connected to pin A2 on MEGA328. This Unit communicates with the M5Core via the GROVE A interface. It's I2C address is 0x52. By reading the data transferred from JOSTICK, you can obtain the motion information of JOYSTICK. ## Product Features - Output value of X, Y direction: 10 ~ 250 - Output value of Z direction is (0: released; 1: pressed) - Software Development Platform : Arduino, UIFlow(Blockly, Python) - Two Lego-compatible holes ## Include - 1x JOYSTICK Unit - 1x Grove Cable ## Applications - Game Controller - Robot remote control ## Specification
Resources Parameter
Communication protocol I2C:0x52
X、Y Axis output value range 10-250
Z Axis output value range 0-1
Net weight 11g
Gross weight 27g
Product Size 48*24*32mm
Package Size 75*45*30mm
## EasyLoader >EasyLoader is a concise and fast program writer, which has a built-in case program related to the product. It can be burned to the main control by simple steps to perform a series of function verification. Please install the corresponding driver according to the device type. M5Core host [Please click here to view the CP210X driver installation tutorial](en/arduino/arduino_development), M5StickC/V/T/ATOM series can be used without driver)

Description:

Show joystick XY data and button status.

## PinMap **Mega328 ISP**Download interface Pin foot definition
M5Core(GROVE A)GPIO22GPIO215VGND
JOYSTICK UnitSCLSDA5VGND
## Protocol - Protocol type I2C - I2C Address: **0x52** ```clike /*--------------------------------------------------------------------------------------------------*/ | JOYSTICK REG | 0x52-0x54 | ------------------------------------------------------------------------------------------------ | joystick_x_reg[0] 0x52 | R | JOYSTICK X VALUE | joystick_x_reg[1] 0x53 | R | JOYSTICK Y VALUE | joystick_btn_reg[2] 0x54 | R | JOYSTICK BTN STATUS /*---------------------------------------------------------------------------------------------------- ``` ## Schematic ## Example ### 1. Arduino - [Click here to download the Arduino example](https://github.com/m5stack/M5Stack/tree/master/examples/Unit/JOYSTICK) ### 2. UIFlow - [Click here to download the UIFlow example](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/JOYSTICK/UIFlow) Last updated: 2020-12-11