arduino - Adafruit 羽毛 BLE 32U4
问题描述
一段时间以来一直在玩arduino,但我对bluefruit/蓝牙设备相当陌生。
我目前正在将 PS/2 球鼠标从 PS2 转换为 USB/蓝牙。我的 USB 部分工作得很好,我的鼠标点击在蓝牙上工作得很好,但对于我的生活,我可以让我的鼠标移动在蓝牙上工作。有人可以帮忙吗??
请记住底部鼠标点击有效。只是不是运动。连接到 USB 时,data.position 类可以正常工作
void controlWired(MouseData data) {
// Mouve Mouse
Mouse.move(data.position.x, (data.position.y * -1), (data.wheel * -1));
// Mouse Click
(data.lClick) ? Mouse.press(MOUSE_LEFT) : Mouse.release(MOUSE_LEFT);
(data.rClick) ? Mouse.press(MOUSE_RIGHT) : Mouse.release(MOUSE_RIGHT);
(data.wClick) ? Mouse.press(MOUSE_MIDDLE) : Mouse.release(MOUSE_MIDDLE);
}
void controlBLE(MouseData data) {
// Mouve Mouse
if (data.position.x != 0 or data.position.y != 0 or data.wheel != 0){
//String mouvement = String(data.position.x) + "," + String((data.position.y * -1)) + "," + String((data.wheel * -1));
ble.print(F("AT+BleHidMouseMove="));
ble.print(data.position.x);
ble.print(",");
ble.print((data.position.y * -1));
ble.print(",");
ble.print((data.wheel * -1));
ble.print(",0");
}
// Mouse Click
(data.lClick) ? ble.sendCommandCheckOK(F("AT+BleHidMouseButton=L,press")) : ble.sendCommandCheckOK(F("AT+BleHidMouseButton=0"));
(data.rClick) ? ble.sendCommandCheckOK(F("AT+BleHidMouseButton=R,press")) : ble.sendCommandCheckOK(F("AT+BleHidMouseButton=0"));
(data.wClick) ? ble.sendCommandCheckOK(F("AT+BleHidMouseButton=C,press")) : ble.sendCommandCheckOK(F("AT+BleHidMouseButton=0"));
}
解决方案
没关系,找到我的问题 ble.print(",0"); 应该是 ble.println(",0");
推荐阅读
- ios - 使用 BigSur 在 Xcode 上的导航器和检查器行为
- php - PHP S3下载:将巨大的文本变量回显到带有标题的浏览器下载
- jquery - 如何使用破折号或逗号设置日期选择器格式?
- angular - 在拦截器中订阅时没有任何反应
- c - 为什么没有写入直接 I/O 文件?
- javascript - 如何使用正则表达式提取这个回调风格函数的主体?
- python-3.x - Pandas .to_sql 随机失败
- view - 有条件地在视图中执行 SQL 查询
- c# - 在 asp.net Web API 中将 multipart/form-Data 图像保存到数据库
- amazon-web-services - 有没有办法通过 Workdocs API 在 Workdocs 中共享文档?