<?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=Temperature_and_humidity_data_collection</id>
		<title>Temperature and humidity data collection - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Temperature_and_humidity_data_collection"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Temperature_and_humidity_data_collection&amp;action=history"/>
		<updated>2026-05-02T10:44:10Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=Temperature_and_humidity_data_collection&amp;diff=2738&amp;oldid=prev</id>
		<title>Pkj：Created page with &quot;{{Language | 温湿度数据采集}} {| style=&quot;width: 800px;&quot; |- | ==Objective== This tutorial will display the temperature and humidity data data in Processing with a curve w...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Temperature_and_humidity_data_collection&amp;diff=2738&amp;oldid=prev"/>
				<updated>2014-05-20T13:25:19Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Language | 温湿度数据采集}} {| style=&amp;quot;width: 800px;&amp;quot; |- | ==Objective== This tutorial will display the temperature and humidity data data in Processing with a curve w...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Language | 温湿度数据采集}}&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 display the temperature and humidity data data in Processing with a curve which measured by the AM2321 sensor.&lt;br /&gt;
&lt;br /&gt;
==Equipment==&lt;br /&gt;
*'''[[Microduino-Core]]'''&lt;br /&gt;
*'''[[Microduino-FT232R]]'''&lt;br /&gt;
'''[[Microduino-Weatherstation]]'''&lt;br /&gt;
*Other equipment&lt;br /&gt;
**USB cable           one  &lt;br /&gt;
&lt;br /&gt;
==Schematic==&lt;br /&gt;
We will use the Microduino-Weatherstation's AM2321 sensor directly.&lt;br /&gt;
&lt;br /&gt;
==Program==&lt;br /&gt;
&lt;br /&gt;
Refers to TemperatureHumidityData&lt;br /&gt;
&lt;br /&gt;
TemperatureHumidityDataArduino&lt;br /&gt;
&lt;br /&gt;
==Debug==&lt;br /&gt;
&lt;br /&gt;
Step 1：Set up hardware system, as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:TemperatureHumidityDataConnectionDiagram.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
Step 2: Explain the code:&lt;br /&gt;
&lt;br /&gt;
This example needs two parts code, one is Processing and the other is Microduino.&lt;br /&gt;
&lt;br /&gt;
Microduino:&lt;br /&gt;
&lt;br /&gt;
//Get the temperature and humidity data for Processing's display.&lt;br /&gt;
&lt;br /&gt;
  void loop()&lt;br /&gt;
  {&lt;br /&gt;
    am2321.read();&lt;br /&gt;
    temperature=(float)am2321.temperature/10.0;&lt;br /&gt;
    humidity=(float)am2321.humidity/10.0;&lt;br /&gt;
    Serial.print(temperature);&lt;br /&gt;
    Serial.print(&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.println(humidity);&lt;br /&gt;
    delay(100);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Processing:&lt;br /&gt;
&lt;br /&gt;
//Get the serial port data,&lt;br /&gt;
// is always my  Arduino, so I open Serial.list()[0].&lt;br /&gt;
// Open whatever port is the one you're using.&lt;br /&gt;
  myPort = new Serial(this, Serial.list()[0], 9600);&lt;br /&gt;
  myPort.bufferUntil('\n'); // Trigger a SerialEvent on new line&lt;br /&gt;
&lt;br /&gt;
//Use the different color's curve to display the data that Microduino sent and mark the table scale&lt;br /&gt;
&lt;br /&gt;
  void draw() {&lt;br /&gt;
    background(255);&lt;br /&gt;
    // Draw lines connecting all points&lt;br /&gt;
    for (int i = 0; i &amp;lt; vals.length-1; i++) {&lt;br /&gt;
      strokeWeight(1);&lt;br /&gt;
      stroke(255,0,0);&lt;br /&gt;
      line(i, vals[i], i+1, vals[i+1]);&lt;br /&gt;
      stroke(0,0,255);&lt;br /&gt;
      line(i, vals2[i], i+1, vals2[i+1]);&lt;br /&gt;
    }&lt;br /&gt;
    // Slide everything down in the array&lt;br /&gt;
    for (int i = 0; i &amp;lt; vals.length-1; i++) {&lt;br /&gt;
      vals[i] = vals[i+1];&lt;br /&gt;
      vals2[i] = vals2[i+1];&lt;br /&gt;
    }&lt;br /&gt;
    String val = myPort.readStringUntil('\n');&lt;br /&gt;
    if (val != null) {&lt;br /&gt;
      val = trim(val);&lt;br /&gt;
      println(val);&lt;br /&gt;
      String tempAndHumidty[]=val.split(&amp;quot;,&amp;quot;); &lt;br /&gt;
      temp=tempAndHumidty[0];&lt;br /&gt;
      humidity=tempAndHumidty[1];&lt;br /&gt;
      lux=Float.parseFloat(val);&lt;br /&gt;
    }&lt;br /&gt;
    vals[vals.length-1] = 200-temp;&lt;br /&gt;
    vals2[vals.length-1] = 200-humidity;&lt;br /&gt;
    //Display scale&lt;br /&gt;
    fill(0, 0, 0);&lt;br /&gt;
    text ( &amp;quot;200-&amp;quot;, 370, 10); &lt;br /&gt;
    text ( &amp;quot;--&amp;quot;, 370, 50); &lt;br /&gt;
    text ( &amp;quot;100-&amp;quot;, 370, 100);&lt;br /&gt;
    text ( &amp;quot;--&amp;quot;, 370, 150); &lt;br /&gt;
    text ( &amp;quot;0-&amp;quot;, 370, 200); &lt;br /&gt;
    //show current num&lt;br /&gt;
    fill(255, 0, 0);&lt;br /&gt;
    text ( &amp;quot;temp:&amp;quot;+temp+&amp;quot;'C&amp;quot;, 0, 15);&lt;br /&gt;
    fill(0, 0, 255);&lt;br /&gt;
    text ( &amp;quot;humidity:&amp;quot;+humidity+&amp;quot;%&amp;quot;, 0, 28);&lt;br /&gt;
  }&lt;br /&gt;
Step 3: Compile the code and download it.&lt;br /&gt;
&lt;br /&gt;
Step 4：After running, change the temperature around the sensor, obserbe the curve.&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
&lt;br /&gt;
Screen will display the temperature and humidity data curve, the temperature curve is red,and the humidity curve is bule. As follows:&lt;br /&gt;
[[File:TemperatureHumidityDataResult.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pkj</name></author>	</entry>

	</feed>