有谁知道mpr121怎么转换成键盘
arduino吧
全部回复
仅看楼主
level 1
MXILiIL 楼主
如何用Arduino nano让mpr121的11个触摸点模拟成键盘上相对应的按键,大佬们,求解!
网上找了半天,折腾一天了都
找不着对应的程序没有程序
想要视频中的效果
2023年03月10日 10点03分 1
level 11
/*
TouchWheel.pde
MPR121 WhellPad Example Code
by:Waiman Zhao
Mail:[email protected]
created on: 11/2/14
license: CC-SA 3.0
Hardware: 3.3V Arduino Pro Mini
SDA -> A4
SCL -> A5
IRQ -> D2
*/
#include <Wire.h>
#include <mpr121.h>
#include "Keyboard.h"
int key = 0;
// ========= setup =========
void setup()
{
// initialize function
Serial.begin(19200);
Wire.begin();
CapaTouch.begin();
// initialize control over the keyboard:
Keyboard.begin();
delay(500);
Serial.println("START");
}
// ========= loop =========
void loop()
{
key = CapaTouch.keyPad();
if (key == 11)
{ Serial.print("key:");
Serial.println("*");
Keyboard.write('*');
}
else if (key == 12)
{
Serial.print("key:");
Serial.println("#");
Keyboard.write('#');
}
else if (key >= 0) {
Serial.print("key:");
Serial.println(key);
Keyboard.write('0' + key);
}
delay(200);
}
2023年03月12日 02点03分 0
C:\Users\pc\AppData\Local\Temp\.arduinoIDE-unsaved2023212-12192-1bsf5jt.p6ot\sketch_mar12a\sketch_mar12a.ino:21:10: fatal error: mpr121.h: No such file or directory #include < compilation terminated. exit status 1 Compilation error: mpr121.h: No such file or directory
2023年03月12日 02点03分
具体报错在楼层里 不能发超过140个字
2023年03月12日 02点03分
噢,你没装这个芯片的库,你去 dfronot 网站找一下
2023年03月12日 02点03分
@2925059 dfrobot 网站找一下
2023年03月12日 02点03分
level 11
如果要模拟键盘,你需要 32u4核心的 pro micro (Leonardo), nano 这种是不行的
2023年03月10日 21点03分 2
就输出键盘10个指定的键,很复杂吗 esp32没程序 stm32没有我说的方案 都不行还要再买个树莓派pico开发板? github上只找到一个树莓派的键盘程序
2023年03月11日 05点03分
@MXILiIL esp32 不支持 usb esp32 s2 s2 才支持
2023年03月11日 05点03分
@2925059 看样子这简单的功能要实现起来很复杂 问了up主,也没要到程序 白瞎30块钱
2023年03月11日 05点03分
@MXILiIL 晚点我给你写一下,我想起来我手上有 dfrobotde这个模块了
2023年03月11日 23点03分
level 1
MXILiIL 楼主
就类似这种效果,实在不行我也没办法了
折腾了好几天,花了我30多块
买了3个开发板 又买了个下载器
2023年03月11日 05点03分 3
level 1
MXILiIL 楼主
2023年03月12日 02点03分 5
level 1
MXILiIL 楼主
奇怪了,
属于是
2023年03月12日 05点03分 7
level 7
可以考虑选用9块9包邮的ESP32C3板子。
模拟键盘鼠标例程在github找不到,是因为开发板库里自带示例了。
2023年03月13日 02点03分 8
本来就有合宙的esp32,问题是没有mpr121的库和代码
2023年03月13日 04点03分
@MXILiIL 硬件库通用,修改I2C对应PIN脚就行了。
2023年03月13日 07点03分
level 1
我超,舞萌人[滑稽]
2023年10月05日 06点10分 9
1