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.
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.
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
Mega328 ISPDownload interface Pin foot definition
To the complete code faces_joystick.ino
, click
here
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)
}