-->

I2C Joystick Unit (MEGA328P)

SKU:U024

Regular price $4.95
Standard Shipping Estimated Delivery Time: 7-20 days
Description

JOYSTICK, we have two types of JOYSTICKs one is build on a panle compatible with FACES Kit, this is the M5Unit version of JOYSTICK

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.

As designed in 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

Kit includes

  • 1x JOYSTICK Unit
  • 1x Grove Cable

Application

  • Game Controller
  • Robot remote control
Learn

Example

1. Arduino IDE

The code below is incomplete(just for usage). To get complete code, please click here.

#include <M5Stack.h>
#include "Wire.h"

#define JOY_ADDR 0x52

// declaration
uint8_t x_data, y_data, button_data;
char data[100];

// initialization
M5.begin();
M5.Lcd.clear();
dacWrite(25, 0);//disable the speak noise
Wire.begin(21, 22, 400000);


// read data
Wire.requestFrom(JOY_ADDR, 3);
if (Wire.available()) {
  x_data = Wire.read();// X(range: 10~250)
  y_data = Wire.read();// Y(range: 10~250)
  button_data = Wire.read();// Z(0: released 1: pressed)
  sprintf(data, "x:%d y:%d button:%d\n", x_data, y_data, button_data);
}

2. UIFlow

To get complete code, please click here.

More information

Schematic

PinMap

M5Core(GROVE A) GPIO22 GPIO21 5V GND
JOYSTICK Unit SCL SDA 5V GND

Customer Reviews

Based on 16 reviews
100%
(16)
0%
(0)
0%
(0)
0%
(0)
0%
(0)
E
E.F.C.Y.
Good stuffs

Good! Very good!!

D
D.O.

Joystick Unit MEGA328P I2C/Grove Connector

S
S.Y.

Joystick Unit MEGA328P I2C/Grove Connector

M
M.H.

Good products. Took 11 days to Japan via registered China Post mail with tracking. Packet in hard shelled box.

B
B.N.

Joystick Unit MEGA328P I2C/Grove Connector

Click to edit the product in Ali Orders.
Note: only show for shop owner