<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Lesson_24--Microduino_Digital_Tube_Thermometer</id>
		<title>Lesson 24--Microduino Digital Tube Thermometer - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Lesson_24--Microduino_Digital_Tube_Thermometer"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Lesson_24--Microduino_Digital_Tube_Thermometer&amp;action=history"/>
		<updated>2026-04-29T23:12:52Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=Lesson_24--Microduino_Digital_Tube_Thermometer&amp;diff=1453&amp;oldid=prev</id>
		<title>Pkj：Created page with &quot;{{Language|第二十四课--Microduino 数码管温度计}} {| style=&quot;width: 800px;&quot; |- | ==Objective== This tutorial will teach you how to use the DS18B20 temperature sensor ...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Lesson_24--Microduino_Digital_Tube_Thermometer&amp;diff=1453&amp;oldid=prev"/>
				<updated>2014-03-16T08:28:23Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Language|第二十四课--Microduino 数码管温度计}} {| style=&amp;quot;width: 800px;&amp;quot; |- | ==Objective== This tutorial will teach you how to use the DS18B20 temperature sensor ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Language|第二十四课--Microduino 数码管温度计}}&lt;br /&gt;
{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
==Objective==&lt;br /&gt;
This tutorial will teach you how to use the DS18B20 temperature sensor get the temperature value and display on digital tube.&lt;br /&gt;
&lt;br /&gt;
==Equipment==&lt;br /&gt;
*'''[[Microduino-Core]]'''&lt;br /&gt;
*'''[[Microduino-FT232R]]'''&lt;br /&gt;
*Other hardware equipment&lt;br /&gt;
**Breadboard Jumper            one box   &lt;br /&gt;
**Breadboard  	               one piece  &lt;br /&gt;
**DS18B20 sensor               one&lt;br /&gt;
**Digital tube                 one&lt;br /&gt;
**USB cable                    one&lt;br /&gt;
&lt;br /&gt;
'''Speaker'''&lt;br /&gt;
[[File:第二十四课-DS18B20温度传感器.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
DS18B20 is a commonly used temperature sensor, it has the the advantages of small volume, low hardware overhead, strong anti-jamming capability and high precision.&lt;br /&gt;
Correct connection: Facing the flat side, left is the negative and right is positive. Once the connection is wrong, it will heat up immediately, may burn! At the same time, this is also the cause of the sensor always displays 85℃.&lt;br /&gt;
&lt;br /&gt;
==Schematic==&lt;br /&gt;
[[File:第二十四课-Microduino数码管温度计原理图.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
Pin Table&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Microduino Pin !! Digital Tube&lt;br /&gt;
|-&lt;br /&gt;
| D2 || 10(A)&lt;br /&gt;
|-&lt;br /&gt;
| D3 || 9(B)&lt;br /&gt;
|-&lt;br /&gt;
| D4 || 1(C)&lt;br /&gt;
|-&lt;br /&gt;
| D5 || 4(D)&lt;br /&gt;
|-&lt;br /&gt;
| D6 || 3(E)&lt;br /&gt;
|-&lt;br /&gt;
| D7 || 6(F)&lt;br /&gt;
|-&lt;br /&gt;
| D8 || 5(G)&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 2(DP)&lt;br /&gt;
|-&lt;br /&gt;
| D10 || 8(LED1)&lt;br /&gt;
|-&lt;br /&gt;
| D11 || 7(LED2)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Program==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
byte digit0 = 10;	//Ten digits bit &lt;br /&gt;
byte digit1 = 11;	//Single digits bit&lt;br /&gt;
byte dotPin = 2;	//Decimal point of digital tube&lt;br /&gt;
&lt;br /&gt;
byte sevenSegmentPins[] = {&lt;br /&gt;
  2,3,4,5,6,7,8};	//A,B,C,D,E,F,G's Microduino pin&lt;br /&gt;
byte sevenSegment[10][7] =&lt;br /&gt;
{&lt;br /&gt;
  //a b c d e f g&lt;br /&gt;
  { &lt;br /&gt;
    0,0,0,0,0,0,1   }&lt;br /&gt;
  ,  // = 0&lt;br /&gt;
  { &lt;br /&gt;
    1,0,0,1,1,1,1   }&lt;br /&gt;
  ,  // = 1&lt;br /&gt;
  { &lt;br /&gt;
    0,0,1,0,0,1,0   }&lt;br /&gt;
  ,  // = 2&lt;br /&gt;
  { &lt;br /&gt;
    0,0,0,0,1,1,0   }&lt;br /&gt;
  ,  // = 3&lt;br /&gt;
  { &lt;br /&gt;
    1,0,0,1,1,0,0   }&lt;br /&gt;
  ,  // = 4&lt;br /&gt;
  { &lt;br /&gt;
    0,1,0,0,1,0,0   }&lt;br /&gt;
  ,  // = 5&lt;br /&gt;
  { &lt;br /&gt;
    0,1,0,0,0,0,0   }&lt;br /&gt;
  ,  // = 6&lt;br /&gt;
  { &lt;br /&gt;
    0,0,0,1,1,1,1   }&lt;br /&gt;
  ,  // = 7&lt;br /&gt;
  { &lt;br /&gt;
    0,0,0,0,0,0,0   }&lt;br /&gt;
  ,  // = 8&lt;br /&gt;
  { &lt;br /&gt;
    0,0,0,1,1,0,0   }   // = 9&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  //Initialize all lights up&lt;br /&gt;
  pinMode(dotPin, OUTPUT); //pin 2&lt;br /&gt;
  pinMode(digit0, OUTPUT); //pin 10&lt;br /&gt;
  pinMode(digit1, OUTPUT); //pin 11&lt;br /&gt;
&lt;br /&gt;
  for(int i=0; i&amp;lt;7; i++)&lt;br /&gt;
  {&lt;br /&gt;
    pinMode(sevenSegmentPins[i], OUTPUT);&lt;br /&gt;
  }&lt;br /&gt;
  digitalWrite(dotPin, HIGH);&lt;br /&gt;
  digitalWrite(digit0, HIGH);&lt;br /&gt;
  digitalWrite(digit1, HIGH);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Display number&lt;br /&gt;
void segmentWrite(byte digit)&lt;br /&gt;
{&lt;br /&gt;
  byte pin = 2;&lt;br /&gt;
  for (byte i=0; i&amp;lt;7; ++i)&lt;br /&gt;
  {&lt;br /&gt;
    digitalWrite(pin, sevenSegment[digit][i]);&lt;br /&gt;
    ++pin;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
  int n = analogRead(A0);    //Read the voltage from AO&lt;br /&gt;
  int vol = n * (5.0 / 1023.0*100);   //Use a float type variable to store temperature value which was converted from voltage value&lt;br /&gt;
&lt;br /&gt;
  //Get the single digits number&lt;br /&gt;
  int sd=vol%10;&lt;br /&gt;
  //Get the ten digits number&lt;br /&gt;
  int td=vol/10;&lt;br /&gt;
&lt;br /&gt;
  digitalWrite(digit0, LOW);   //Turn off ten digits bit digital tube&lt;br /&gt;
  segmentWrite(sd);             //Display single digits bit&lt;br /&gt;
  delay(10);                  //Delay 10ms &lt;br /&gt;
  digitalWrite(digit0, HIGH);  //Turn on ten digits bit digital tube&lt;br /&gt;
  digitalWrite(digit1, LOW);   //Turn off single digits bit digital tube&lt;br /&gt;
  segmentWrite(td);             //Diplay ten digits bit&lt;br /&gt;
  delay(10);                  //Dealy 10ms&lt;br /&gt;
  digitalWrite(digit1, HIGH);  //Turn on single digital tube&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debug==&lt;br /&gt;
Step 1：Copye the cdoe to IDE and compile it&lt;br /&gt;
&lt;br /&gt;
Step 2：Set up circuti, as follows：&lt;br /&gt;
&lt;br /&gt;
[[File:第二十四课-Microduino数码管温度计连接图.jpg|600px|center|thumb]]&lt;br /&gt;
Step 3：Run program&lt;br /&gt;
&lt;br /&gt;
Step 4：Observe the digital tube, find a hot object close to the temperature sensor, the value on digital tube will change.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
&lt;br /&gt;
The temperature sensor closes to the hot object, the value will increase.&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
&lt;br /&gt;
http://v.youku.com/v_show/id_XNjgyMzE4ODg4.html&lt;/div&gt;</summary>
		<author><name>Pkj</name></author>	</entry>

	</feed>