zoologist 发表于 2023-3-12 10:00:38

Touch Kit 电容触摸板转USB输入测试


Touch Kit 电容触摸板套件 (DFR0129)搭配 Arduino Pro Micro 实现了触摸转USB键盘输入。




接线方面如下:

GND<------->GND
VCC   <------->RAW
SDA   <------->D3
SCL    <------->D4
IRQ    不连接
ADDR 不连接

/*
TouchWheel.pde
MPR121 WhellPad Example Code

by:Waiman Zhao
Mail:Binpower@foxmail.com
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);
}








zoologist 发表于 2023-3-12 10:01:58

https://www.bilibili.com/video/BV1bg4y1b7vd/?pop_share=1&vd_source=cf6121716e06cb669a27c10276f9c920
页: [1]
查看完整版本: Touch Kit 电容触摸板转USB输入测试