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);
}