pdf-icon

Module JOYSTICK

SKU:A007

Description

JOYSTICK is a joystick control panel compatible with the FACE kit. By pushing the joystick on the panel, you can input angle, direction and other data. Using the I2C communication protocol. It's possible to get the offset data of the joystick (X, Y coordinate) and the state of the middle button. An LED bar composed of 12 LEDs is embedded around the joystick. You can customize the luminous form of the LED light according to your needs.

Product Features

  • 4 RGB Led
  • I2C communication
  • Simple API for programming

Include

  • 1x M5Stack JOYSTICK Module board
  • 1x Joystick Bar

Specification

Resources Parameter
Net weight 22g
Gross weight 50g
Product Size 58*54*10mm
Package Size 95*65*25mm

JOYSTICK I2C address is 0x5E by default.

EasyLoader

download EasyLoader

1.EasyLoader is a simple and fast program burner. Every product page in EasyLoader provides a product-related case program. It can be burned to the master through simple steps, and a series of function verification can be performed.

2.After downloading the software, double-click to run the application, connect the M5 device to the computer via the data cable, select the port parameters, and click "Burn" to start burning.

3.The CP210X (USB driver) needs to be installed before the EasyLoader is burned. Click here to download driver

PinMap

Mega328 ISPDownload interface Pin foot definition

Learn

The classic '70s and '80s Simon game revived on the M5Stack and created fully in UIflow.

Example

Arduino IDE

To the complete code faces_joystick.ino, click here

UIFlow

Function

Control single RGB

/*
    Parameter:
        indexOfLED: 0 ~ 11
        r, g, b: 0 ~ 254
*/
void Led(int indexOfLED, int r, int g, int b){
  Wire.beginTransmission(FACE_JOY_ADDR);
  Wire.write(indexOfLED);
  Wire.write(r);
  Wire.write(g);
  Wire.write(b);
  Wire.endTransmission();
}

Read the offset of each direction

void get_joystick_offset(void){
  Wire.requestFrom(FACE_JOY_ADDR, 5);
  if (Wire.available()) {

    y_data_L = Wire.read();
    y_data_H = Wire.read();
    x_data_L = Wire.read();
    x_data_H = Wire.read();

    button_data = Wire.read();// Z(0: released 1: pressed)
}