Available for Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. I/O pin range options will vary with board type.
These blocks are for the CM2302 Temperature & Humidity Sensor (#28059 [1]). It is also compatible with most DHT22 and AM2302 models.
See the next page for a Getting Started tutorial, and/or watch the Tiny Tutorial video below.
The Temp & Humidity read block triggers a supported sensor connected to the specified I/O pin to take and store temperature and relative humidity readings. Readings can be updated every 30 seconds.
The PIN menu this block can be set to "other." When "other" is chosen, the dropdown menu disappears, and it is replaced with an input. You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:
The Temp & Humidity value block provides the specified measurement from the data stored by the last Temp & Humidity read block. Choose the type of data from the drop-down menu. Options are:
BlocklyProp uses integer math: The value returned by this block is 10 times the temperature or relative humidity measured by the sensor. To display the reading, use a print multiple block's floating point option for the Terminal, LCD, or OLED, and choose to divide the value by 10 on that block. See the wiring diagram and example code on the next page.
The CM2302 Temperature and Humidity Sensor can take a reading of temperature and relative humidity for use by a microcontroller such as the Propeller.
The example code below displays the temperature and relative humidity in the BlocklyProp Terminal. BlocklyProp uses integer math; the Temp & Humidity value block provides a value that is 10 times larger than the sensor reading.
To display the sensor readings as floating-point values, use the Terminal print multiple block. Click its gear icon, drag in text and floating point number blocks, and then click specify digits box:
Here is the complete code listing:
Save and run the project to display the data in the BlocklyProp Terminal:
Links
[1] http://www.parallax.com/product/28059