From b860268e4846935f924623379b01748aeadb1bca Mon Sep 17 00:00:00 2001 From: LT000-ops Date: Thu, 15 Aug 2024 20:06:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Arduino=E5=8F=AF=E7=BC=96?= =?UTF-8?q?=E7=A8=8B=E6=89=8B=E6=9F=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Programmable_controller.md | 17 +++++++++++++++-- .../examples/gamepad/.vscode/arduino.json | 3 --- 2 files changed, 15 insertions(+), 5 deletions(-) delete mode 100644 docs/open_source_hardware/arduino_programmable_controller/example/examples/gamepad/.vscode/arduino.json diff --git a/docs/open_source_hardware/arduino_programmable_controller/Programmable_controller.md b/docs/open_source_hardware/arduino_programmable_controller/Programmable_controller.md index 72b3384..367b97e 100644 --- a/docs/open_source_hardware/arduino_programmable_controller/Programmable_controller.md +++ b/docs/open_source_hardware/arduino_programmable_controller/Programmable_controller.md @@ -432,6 +432,7 @@ enum ButtonType : uint8_t { kButtonD = 8, kButtonMax, }; +//这里只用直接调用你需要判断的按键类型,即可。比如说判断手柄端的A键是否按下,就只用输入emakefun::GamepadModel::kButtonA就行,其他按键的判断按照这样的参数修改ButtonType类型即可。 ``` #### g_gamepad_model.Tick() @@ -479,20 +480,32 @@ bool ButtonReleased(const ButtonType button_type) const { #### 获取摇杆和重力加速度的值 -摇杆: +**摇杆**: + +获取X轴上的摇杆值: `GetJoystickCoordinate().x` +获取Y轴上的摇杆值: + `GetJoystickCoordinate().y` -重力加速度: +**重力加速度**: + +获取X轴上重力加速度值: `g_gamepad_model.GetGravityAcceleration().x` +获取Y轴上重力加速度值: + `g_gamepad_model.GetGravityAcceleration().y` +获取Z轴上重力加速度值: + `g_gamepad_model.GetGravityAcceleration().z` + + 以上函数直接调用即可 若遇上解决不了的问题 diff --git a/docs/open_source_hardware/arduino_programmable_controller/example/examples/gamepad/.vscode/arduino.json b/docs/open_source_hardware/arduino_programmable_controller/example/examples/gamepad/.vscode/arduino.json deleted file mode 100644 index 2f79f66..0000000 --- a/docs/open_source_hardware/arduino_programmable_controller/example/examples/gamepad/.vscode/arduino.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "board": "arduino:avr:uno" -} \ No newline at end of file