触摸传感器轮询读取
功能概述
本示例演示了使用触摸传感器进行轮询读取。
环境要求
触摸传感器按键如下表连接:
IO 编号 | IO 名称 | touch 编号 |
---|---|---|
16 | PB0 | 3 |
17 | PB0 | 4 |
18 | PB0 | 5 |
12 | PA12 | CMOD |
14 | PA14 | CMC |
编译和烧录
示例位置:examples/peripheral/touch_sensor/touch_poll
编译、烧录等操作请参考:快速入门
运行结果
成功运行将输出如下日志
D/dt [0.038] add device touch_sensor
D/dt [0.042] add device gpio
Touch Sensor read, the output format is:
Touch sensor num:[raw data]
T3: [1975] T4: [2112] T5: [2520]
T3: [1980] T4: [2163] T5: [2468]
T3: [1959] T4: [2123] T5: [2506]
T3: [1978] T4: [2155] T5: [2463]
T3: [1948] T4: [2139] T5: [2505]
T3: [1994] T4: [2154] T5: [2442]
T3: [1968] T4: [2155] T5: [2516]
T3: [1982] T4: [2145] T5: [2459]
T3: [1975] T4: [2144] T5: [2528]
T3: [1970] T4: [2154] T5: [2525]
T3: [1996] T4: [2144] T5: [2526]
T3: [1973] T4: [2152] T5: [2533]
T3: [1995] T4: [2161] T5: [2519]
T3: [1981] T4: [2140] T5: [2526]
T3: [1939] T4: [2156] T5: [2512]
T3: [1978] T4: [2138] T5: [2507]