20141115 【 Arduino - LM35 - 4位八段数码管 】 数码管显示温度
2014-11-15 12:01
417 查看
4位八段数码管型号:SMA420564
引脚图如下:
通过公式,转换成温度值(摄氏度,精确到小数点后一位)。
不过 LM35 之前被我正负极反接,
结果温度升的奇高(手测超过80°C),
不知道有没有烧坏。(好像还能用吧!!!)
引脚图如下:
通过公式,转换成温度值(摄氏度,精确到小数点后一位)。
不过 LM35 之前被我正负极反接,
结果温度升的奇高(手测超过80°C),
不知道有没有烧坏。(好像还能用吧!!!)
const int pinLM = A5; const int Vmax = 625; //5000:1024 const int LMmax = 128; const int pinChoose[4] = {10,11,12,13}; const int pinLCD[8] = {2,3,4,5,6,7,8,9}; const int num[17] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71, 0x80}; // 0123456789 AbCdEF. + 17 int flash = 2; //工作指示灯 void setup() { pinMode(pinLM, INPUT); for(int i=0; i<4; i++) pinMode(pinChoose[i], OUTPUT); for(int i=0; i<8; i++) pinMode(pinLCD[i], OUTPUT); Serial.begin( 9600 ); } void loop() { unsigned int t = analogRead(pinLM); t = t*Vmax/LMmax; Serial.println( t ); for(int i=200; i; i--){ show_t( t ); //数码管显示温度 } flash = ~flash; //工作指示灯 闪烁 } void show_num(int nx){ for(int i=0; i<8; i++) digitalWrite(pinLCD[i], ((1<<i)&nx)); } void show_t(int x){ for(int i=3; i>=0; i--){ digitalWrite(pinChoose[i], LOW); if( x ) if( i==flash ) show_num( num[x%10]|0x80 ); else show_num( num[x%10] ); else show_num( 0x00 ); delay(1); show_num( 0x00 ); //消影 x /= 10; digitalWrite(pinChoose[i], HIGH); } }
相关文章推荐
- 20141016 【Arduino + C51单片机】 八段数码管--数字循环显示
- Arduino ADC + 模拟温度传感器LM35D
- 18b20温度数码管显示
- DHT11实现温度湿度的数码管显示
- 20141119 【 Arduino - DHT11 - 单片机 】 利用单片机数码管 显示 DHT11温湿度
- Arduino LM35温度检测
- 实验六:温度传感DS18B20实验(数码管显示)
- Arduino 595多级并联 Arduino显示八位数码管
- Arduino 用4位共阴数码管造一个计数器
- 单片机 & 4×4矩阵键盘 & 4位串行595数码管显示
- DS18B20温度传感器,将实时温度用数码管显示
- Arduino使用TM1637四位数码管显示模块
- Arduino LCD 温度显示
- 【Arduino】1、用LCD12864显示从18B20上读取的温度值
- Arduino 串口输出LM35温度
- 温度传感器(18b20测温然后在数码管上显示)
- 【Arduino】使用LM35传感器实时测量温度
- 4位共阳数码管 显示数字,调节亮度,时钟调时,控制LED巧妙编程
- 在web浏览器上显示室内温度(nodeJs+arduino+socket.io)
- 基于51单片机及DS18B20温度传感器数码管显示程序