通过手柄与Qt的通信,发送指令至远程设备,控制远程设备的运动。
主要代码://连接设备
QGamepad *m_gamepad = new QGamepad(0, this);
...
//显示手柄按下的按键的名称
connect(m_gamepad, &QGamepad;::buttonAChanged, this, [=](bool pressed){
showCurrentBtnName(pressed, "buttonA");
});
connect(m_gamepad, &QGamepad;::buttonBChanged, this, [=](bool pressed){
showCurrentBtnName(pressed, "buttonB");
});
...
//显示摇杆的值
connect(m_gamepad, &QGamepad;::buttonL2Changed, this, [=](double value){
showBtnVaule(1, value);
});
connect(m_gamepad, &QGamepad;::buttonR2Changed, this, [=](double value){
showBtnVaule(2, value);
});
---------------------
1