first commit
This commit is contained in:
1
代码案例/6 Arduino基础学习/29 模拟输入2 – analogRead/.pydio
Normal file
1
代码案例/6 Arduino基础学习/29 模拟输入2 – analogRead/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
0b9e8643-efff-4015-b874-5af1381542c2
|
||||
@@ -0,0 +1 @@
|
||||
0319c1b5-fda1-4821-a831-e8511e940c46
|
||||
30
代码案例/6 Arduino基础学习/29 模拟输入2 – analogRead/analogRead/analogRead.ino
Executable file
30
代码案例/6 Arduino基础学习/29 模拟输入2 – analogRead/analogRead/analogRead.ino
Executable file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
模拟输入
|
||||
|
||||
本程序旨在演示如何使用analogRead()读取Arduino的引脚电平。
|
||||
通过调节电位器, A0引脚的输入电压将在0V-5V之间。
|
||||
该输入电压将被映射到数值0-1023之间,并显示在串口监视器中。
|
||||
|
||||
电路连接:
|
||||
电位器中间引脚连接到模拟输入A0引脚
|
||||
电位器两端引脚分别连接在Arduino +5V和接地引脚
|
||||
|
||||
太极创客 www.taichi-maker.com
|
||||
2017-01-08
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// 串口通讯初始化(9600 bps):
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// 读取模拟输入值:
|
||||
int analogInputVal = analogRead(A0);
|
||||
|
||||
// 将结果通过串口监视器显示:
|
||||
Serial.println(analogInputVal);
|
||||
}
|
||||
Reference in New Issue
Block a user