当前位置:网站首页>Arduino UNO通过电容的直接检测实现简易触摸开关
Arduino UNO通过电容的直接检测实现简易触摸开关
2022-06-27 21:41:00 【perseverance52】
Arduino 通过电容的直接检测实现简易触摸开关

Arduino除了接受数字端口的数字信号,唯一能检测的模拟物理量就是电压。任何模拟传感器的检测值几乎都是通过相关电路转化成电压值,再输入它的模拟端口进行模数转换的。电容值就需要相对更复杂和昂贵的电路转化为电压值,才能被Arduino检测,而对很多物理过程的检测,都可以很方便可靠地通过检测电容值来实现。
实现方法
把一个数字端口设成低电位,并打开arduino的内部上拉电阻,开始计算这个端口到达高电位所需要的时间。而这个时间与此端口的对地电容值有关,电容越大,时间越长。在硬件上只需要在一个端口上连一根导线即可。用手指触摸这段导线的裸露端,就会导致电容变化,arduino可以通过上述方法检测这个变化。如果要增加灵敏度,可以在导线上连一片锡箔。为防止你手上有强静电击穿芯片,可以在锡箔上盖一层薄纸。
示例代码
不需要第三方库
// readCapacitivePin
//输入:Arduino pin number边栏推荐
- 现代编程语言:Rust (铁锈,一文掌握钢铁是怎样生锈的)
- Feign implements path escape through custom annotations
- Feign通过自定义注解实现路径的转义
- 吴恩达《机器学习》课程总结(11)_支持向量机
- c语言-日期格式化[通俗易懂]
- VirtualBox extended dynamic disk size pit
- 单片机之IIC通信协议「建议收藏」
- [PCL self study: Segmentation3] PCL based point cloud segmentation: region growth segmentation
- 内网IP和公网IP的区别及作用
- ICML 2022:ufrgs | optimistic linear support and subsequent features as the basis for optimal strategy transfer
猜你喜欢

Zero foundation self-study SQL course | complete collection of date functions in SQL

本地可视化工具连接阿里云centOS服务器的redis

炼金术(7): 何以解忧,唯有重构

Instructions for vivado FFT IP

Sécurité, économie de carburant et protection de l'environnement chameau

认识微信小程序项目的基本组成结构

技术的极限(11): 有趣的编程
![用两个栈实现队列[两次先进后出便是先进先出]](/img/de/07297816f1a44d41389bb45d012c80.png)
用两个栈实现队列[两次先进后出便是先进先出]

Local visualization tool connects to redis of Alibaba cloud CentOS server
![[tinyriscv verilator] branch transplanted to Da Vinci development board of punctual atom](/img/a8/4786e82d0646b08c195dd0a17af227.png)
[tinyriscv verilator] branch transplanted to Da Vinci development board of punctual atom
随机推荐
【AI应用】NVIDIA Tesla V100-PCIE-32GB的详情参数
表单form 和 表单元素(input、select、textarea等)
CRTMP视频直播服务器部署及测试
Feign通过自定义注解实现路径的转义
An analysis of C language functions
Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance
认识微信小程序项目的基本组成结构
How to select documents for literature review? For example, I can't finish reading more than 200 search results. How to select documents
炼金术(8): 开发和发布的并行
ICML 2022:ufrgs | optimistic linear support and subsequent features as the basis for optimal strategy transfer
Is it safe for Huatai Securities to open an account online?
Recyclerview implements grouping effects in a variety of ways
C language - date formatting [easy to understand]
How to use raspberry pie (and all kinds of pies)
One step forward is excellent, one step backward is ignorant
golang使用mongo-driver操作——查(基础)
Google Earth engine (GEE) 03 vector data type
【PCL自学:PCLPlotter】PCLPlotter绘制数据分析图
系统学习+主动探索,是最舒适的入门学习方式!
[VIM] tutorial, common commands, efficient use of vim editor