Unit Joystick2 ESPHomeコンポーネント

このページでは、ESPHomeでUnit Joystick2を使用するI2Cジョイスティックコンポーネントについて説明します。X/Y 軸の値、Z 軸ボタンの状態、内蔵 RGBライトを提供します。

1. コンポーネント概要

項目 情報
製品名 Unit Joystick2
SKU U024-V2
主な機能 X/Y 軸ジョイスティック入力、Z 軸ボタン、RGBライティング制御
通信インターフェース I2C
デフォルトI2Cアドレス 0x63
ESPHomeコンポーネント i2c_joystick_2(外部コンポーネント)
ESPHomeバージョン要件 /

2. コンポーネントの説明

外部コンポーネントの導入

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

Sensor: ジョイスティック軸

X/Y 軸にはi2c_joystick_2のSensorプラットフォームを使用します。axisはxまたはy、modeはadc_16bit、adc_8bit、offset_12bit、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

Binary Sensor: ボタン

Z 軸ボタンにはi2c_joystick_2のBinary Sensorプラットフォームを使用します。

binary_sensor:
  - platform: i2c_joystick_2
    id: joystick2_button
    i2c_joystick_2_id: joystick2
    name: "Joystick2 Button"

Light: RGBライティング

3つのi2c_joystick_2 Outputチャンネルを組み合わせてRGBライトエンティティを作成します。チャンネル値はCHANNEL_R、CHANNEL_G、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

3. 使用例

4. 関連リンク

Page Tools
PDF
On This Page