Arduino例程解读与实验(01-06.读取模拟电压)

该博客介绍了如何使用Arduino读取模拟电压。通过连接电位器到A0引脚,程序将读取模拟输入,进行AD转换,并将电压值通过串口发送到Serial Monitor。示例代码展示了如何实现这一功能,包括初始化串口通信和读取A0引脚的模拟值。
摘要由CSDN通过智能技术生成

Arduino例程解读与实验(01-06.读取模拟电压)

/*
ReadAnalogVoltage//读取模拟电压

Reads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor.//读取A0脚上的模拟电压并在串口监视器上显示
Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu).//可以通过编译器上方工具栏的“工具/串口绘图器”使用串口绘图功能显示图形
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.//把电位器中间引脚连接A0,两边的引脚连接5V电源和地线。

This example code is in the public domain.//例程代码见以下域名

http://www.arduino.cc/en/Tutorial/ReadAnalogVoltage
*/

// the setup routine runs once when you press reset:按下复位键后setup()只运行一次
void setup() {
// initialize serial communication at 9600 bits per second://打开Arduino板和计算机的串口连接(波特率指定为9600)。
Serial.begin(9600);
}

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值