Arduino 串口输出LM35温度
2017-03-11 23:34
447 查看
#include "stdlib.h" float temp = 0.0; float maxtemp = 0.0; float mintemp =100.0; // the setup routine runs once when you press reset: void setup() { Serial.begin(9600); Serial.println(F("reading temperature begin. \n")); } // the loop routine runs over and over again forever: void loop() { static unsigned long sensortStamp = 0; if(millis() - sensortStamp > 1000){ sensortStamp = millis(); // read the LM35 sensor value and convert to the degrees every 100ms. int reading = analogRead(0); //把LM35的输出端连接到了A0,所以这里是analogRead(0) temp = reading *0.0048828125*100; if(temp >= maxtemp) maxtemp = temp; if(temp <= mintemp) mintemp = temp; Serial.print(F("Real Time Temp: ")); Serial.print(temp); Serial.print(F(" Max Temp: ")); Serial.print(maxtemp); Serial.print(F(" Min Temp: ")); Serial.println(mintemp); } }
相关文章推荐
- Arduino学习笔记之Arduino的数字输出&串口输入
- Arduino ADC + 模拟温度传感器LM35D
- 【Arduino】使用LM35传感器实时测量温度
- Arduino学习笔记之 Arduino的串口输出
- arduino 智能小车(蔽障、蜂鸣提醒、警示led灯,带串口输出)
- [Arduino]添加输出,运行程序时,串口显示器的输出乱码
- arduino 液晶显示 LM35温度传感器
- Arduino LM35温度检测
- 使用 Arduino 和 LM35 温度传感器监测温度
- 20141115 【 Arduino - LM35 - 4位八段数码管 】 数码管显示温度
- Arduino运行时突然[卡死在某一行/立即重启/串口输出乱码/程序执行不正常]的可能原因
- BlackBerry 10 , BlackBerry OS 7.1 手机通过蓝牙串口读取Arduino 蓝牙传过来的温度 湿度信息
- [Arduino]运行程序时,串口显示器的输出乱码
- 用Android手机通过蓝牙模块HC-06连接Arduino串口输出
- uboot源码阅读(九)开发板启动串口输出
- 74hc595串口转并口输出
- DSP下面printf串口输出的实现
- 【单片机】串口输出字符串程序
- 使用Arduino开发板制作自动空调温度控制器
- arduino学习系列——串口通信