现在,当你打开你在Arduino IDE软件上的串口监视器(可以通过键盘快捷键Ctrl+Shift+M打开),你应该看到一个范围从0.0-5.0的稳定的数据流。随着你转动那个旋钮,这个输入到A0引脚的电压值会随之变化。 /* ReadAnalogVoltage Reads an analog input on pin 0, converts it to voltage, and prints the result to the...
Serial.println(voltage) 现在,当你打开你在Arduino IDE软件上的串口监视器(可以通过键盘快捷键Ctrl+Shift+M打开),你应该看到一个范围从0.0-5.0的稳定的数据流。随着你转动那个旋钮,这个输入到A0引脚的电压值会随之变化。 /* ReadAnalogVoltage Reads an analog input on pin 0, converts it to voltage, and pr...
ReadAnalogVoltage Reads an analog input on pin 0, converts it to voltage, and prints the result...
/*ReadAnalogVoltage 读取模拟电压 Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor. OPEN THE SERIAL MONITOR TO VIEW THE OUTPUT >> Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground. 读取引脚0...
格瑞图:Arduino-0005-内置示例-数字串口读取 Digital Read Serial 格瑞图:Arduino-0006-内置示例-亮度调节 Fade 1、示例代码及解析 (1)代码 /*ReadAnalogVoltageReads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor.Graphical representation is available using...
格瑞图:Arduino-0007-内置示例-读取模拟电压 Read Analog Voltage 格瑞图:Arduino-0008-内置示例-非延迟闪烁 Blink Without Delay 格瑞图:Arduino-0009-内置示例-按钮 Button 格瑞图:Arduino-0010-内置示例-去抖 Debounce 格瑞图:Arduino-0011-内置示例-数字输入上拉 DigitalInputPullup ...
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float voltage = sensorValue * (5.0 / 1023.0); // print out the value you read: Serial.println(voltage); } 火焰传感器 接线图 火焰传感器对火焰最敏感,对普通光也是有反应的,一般用做火焰报警等用途。
//read the input on analog pin 0: floatsensorValue = analogRead(A0); //convert ADC value to voltage floatVin = 5 * sensorValue / 1023; //print out the value you read: Serial.println(Vin); delay(1); //delay in between reads for stability ...
// read the input on analog pin 0: float sensorValue = analogRead(A0); // convert ADC value to voltage float Vin = 5 * sensorValue / 1023; // print out the value you read: Serial.println(Vin); delay(1); // delay in between reads for stability ...
ReadAnalogVoltage Reads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor. 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...