LM35温度传感器:1 个
面包板:1个
杜邦线:3根
VCC引脚接 5V 电源
OUT引脚接 A0接口
GND引脚接 GND 接口
- #define temp_pin A0 //温度传感器引脚
-
- void setup(){
- Serial.begin(9600);
- }
-
- void loop(){
- float val = analogRead(temp_pin);
- float temp_val = val * 0.4883; //温度计算公式
- Serial.print("温度: ");
- Serial.print(temp_val);
- Serial.println(" ℃");
- delay(1000);
- }

通过本次实验,我学会了 LM35 传感器的使用。