Difference between revisions of "Electronic Hygrometer"
(Created page with "{| style="width: 1000px;" |- | ==Outline== 600px|center Make a humidity indicator, which can light red when the humidity is lower, and green when t...") |
|||
Line 46: | Line 46: | ||
==Programming== | ==Programming== | ||
===Required Program Block=== | ===Required Program Block=== | ||
− | *[[ | + | *[["Temperature & Humidity" program block]] |
− | *[[ | + | *[["Declare as", "item" program block]] |
− | *[[ | + | *[["If-else" program block]] |
− | *[[ | + | *[["ColorLED prepare" program block]] |
− | *[[ | + | *[["ColorLED control" program block]] |
− | *[[ | + | *[["Println" program block]] |
===Programming Thought=== | ===Programming Thought=== | ||
Line 58: | Line 58: | ||
===Start to Program=== | ===Start to Program=== | ||
− | '''Declare a variable named | + | '''Declare a variable named "h" to save the humidity value read. ''' |
<br> | <br> | ||
ColorLED prepare: connect one color LED to pin 6. Declare a variable named h, which can save a float number. Write the value of the humidity sensor into the variable h. | ColorLED prepare: connect one color LED to pin 6. Declare a variable named h, which can save a float number. Write the value of the humidity sensor into the variable h. | ||
Line 81: | Line 81: | ||
Q: Now we can judge whether the indoor humidity is moderate by the color of the color LED, how to see specific humidity value? | Q: Now we can judge whether the indoor humidity is moderate by the color of the color LED, how to see specific humidity value? | ||
<br> | <br> | ||
− | A: We can display the real-time humidity (temperature) value on the computer screen through a new program block [[ | + | A: We can display the real-time humidity (temperature) value on the computer screen through a new program block [["Println" program block]]. |
<br> | <br> | ||
'''Print the current humidity value.''' | '''Print the current humidity value.''' | ||
Line 101: | Line 101: | ||
==FAQ== | ==FAQ== | ||
− | *Q: Why | + | *Q: Why don't assign the humidity value to "h" directly when it is declared? |
− | **A: Because | + | **A: Because "declare a variable" is executed during program initialization, which means it can only be executed once. "Variable assignment" is executed in the process of program running in cycle. If only we need to real-timely detect the humidity, we must use the "variable assignment" program block, otherwise we will not get the real-time humidity value. |
<br> | <br> | ||
*Q: What does the baud rate mean on the serial monitor? | *Q: What does the baud rate mean on the serial monitor? | ||
**A: Baud rate refers to the transmission speed between computer and the core module, which is 9600 by default. If the baud rate is not same with the set one, data transmission will come across garbed words. | **A: Baud rate refers to the transmission speed between computer and the core module, which is 9600 by default. If the baud rate is not same with the set one, data transmission will come across garbed words. | ||
|} | |} |
Latest revision as of 05:18, 13 October 2016
ContentsOutlineMake a humidity indicator, which can light red when the humidity is lower, and green when the humidity is moderate, and blue when the humidity is higher.
Module BillModule
Other Equipment
Module SetupSetup
ProgrammingRequired Program Block
Programming ThoughtIf the humidity is lower than 45%, the color LED will change into red, representing that the air is dry; if the humidity is larger than 65%, the color LED will change into blue, representing the air is wet; if the humidity is between 45-65%, the color LED will change into green, representing the air is gentle. Start to ProgramDeclare a variable named "h" to save the humidity value read.
Change the color of the color LED according to the humidity value.
Check the real-time humidity value on the serial port.
Technical Specification
Related Cases
FAQ
|