Joystick Panel for M5 FACES

SKU:A007

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

JOYSTICK is a control column module. A joystick is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. Same as ENCODER, it is compatible with FACE Kit. You can have it replace the keycoard panel inside the FACE kit. Through IIC you can get the offset data form (X, Y) axis, also the button status. You can customized the LED behavior as you like.

JOYSTICK IIC address is 0x5E).

Product Features

  • 12 RGB Led
  • IIC communication
  • Simple API for programming

Kit includes

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

Function

Control single LED

/*
    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)
}

Example

Arduino IDE

To the complete code faces_joystick.ino, click here

/*
* faces_joystick.ino
*/
#include <M5Stack.h>

#define FACE_JOY_ADDR     0X5E

// declaration
uint8_t x_data_L;
uint8_t x_data_H;
uint8_t y_data_L;
uint8_t y_data_H;
uint8_t button_data;
uint16_t x_data;
uint16_t y_data;

// initialization
M5.begin();
Wire.begin();

// get data from ENCONDER
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)
  x_data = x_data_H << 8 |x_data_L;
  y_data = y_data_H << 8 |y_data_L;
}

// IIC send data, 4bytes
Wire.beginTransmission(FACE_JOY_ADDR);
Wire.write(indexOfLED);
Wire.write(r);
Wire.write(g);
Wire.write(b);
Wire.endTransmission();

Customer Reviews

Based on 15 reviews
100%
(15)
0%
(0)
0%
(0)
0%
(0)
0%
(0)
J
J.A.

Joystick Panel for M5 FACE

R
R.R.

Joystick Panel for M5 FACE

O
O.H.

Highly recommended

J
J.F.

Joystick Panel for M5 FACE

G
G.L.

Joystick Panel for M5 FACE

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