This page describes the I2C joystick component for Unit Joystick2 in ESPHome. It provides X/Y-axis values, Z-axis button status, and onboard RGB lighting control.
| Item | Information |
|---|---|
| Product name | Unit Joystick2 |
| SKU | U024-V2 |
| Main functions | X/Y-axis joystick input, Z-axis button, and RGB lighting control |
| Communication interface | I2C |
| Default I2C address | 0x63 |
| ESPHome component | i2c_joystick_2 (external component) |
| ESPHome version requirement | / |
external_components:
- source: github://m5stack/esphome-yaml/components
components: [i2c_joystick_2]
refresh: 0s
i2c_joystick_2:
- id: joystick2
i2c_id: i2c_bus
address: 0x63 Use the i2c_joystick_2 Sensor platform for the X and Y axes. axis accepts x or y; mode accepts adc_16bit, adc_8bit, offset_12bit, or offset_8bit.
sensor:
- platform: i2c_joystick_2
id: joystick2_x
i2c_joystick_2_id: joystick2
name: "Joystick2 X"
axis: x
mode: offset_12bit
update_interval: 100ms
- platform: i2c_joystick_2
id: joystick2_y
i2c_joystick_2_id: joystick2
name: "Joystick2 Y"
axis: y
mode: offset_12bit
update_interval: 100ms Use the i2c_joystick_2 Binary Sensor platform for the Z-axis button.
binary_sensor:
- platform: i2c_joystick_2
id: joystick2_button
i2c_joystick_2_id: joystick2
name: "Joystick2 Button" Combine three i2c_joystick_2 Output channels into an RGB light entity. The channel values are CHANNEL_R, CHANNEL_G, and CHANNEL_B.
output:
- platform: i2c_joystick_2
id: joystick2_red
i2c_joystick_2_id: joystick2
channel: CHANNEL_R
- platform: i2c_joystick_2
id: joystick2_green
i2c_joystick_2_id: joystick2
channel: CHANNEL_G
- platform: i2c_joystick_2
id: joystick2_blue
i2c_joystick_2_id: joystick2
channel: CHANNEL_B
light:
- platform: rgb
name: "Joystick2 Light"
red: joystick2_red
green: joystick2_green
blue: joystick2_blue