Jump to content

Component: Temp / Humidity (SHT31) (Environmental): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(5 intermediate revisions by the same user not shown)
Line 54: Line 54:


===GetHumidityInt===
===GetHumidityInt===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityInt'''
| width="90%" class="mtx-class-macrohead" | '''GetHumidityInt'''
|-
|-
| colspan="2" | returns the relative Humidity reading as an integer value 
| colspan="2" | returns the relative Humidity reading as an integer value 
Line 68: Line 68:


===GetHumidityReal===
===GetHumidityReal===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityReal'''
| width="90%" class="mtx-class-macrohead" | '''GetHumidityReal'''
|-
|-
| colspan="2" | returns the Humidity reading as a float value 
| colspan="2" | returns the Humidity reading as a float value 
Line 82: Line 82:


===GetTemperatureInt===
===GetTemperatureInt===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTemperatureInt'''
| width="90%" class="mtx-class-macrohead" | '''GetTemperatureInt'''
|-
|-
| colspan="2" | Return temperature reading as an integer value in degrees C 
| colspan="2" | Return temperature reading as an integer value in degrees C 
Line 96: Line 96:


===GetTemperatureReal===
===GetTemperatureReal===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTemperatureReal'''
| width="90%" class="mtx-class-macrohead" | '''GetTemperatureReal'''
|-
|-
| colspan="2" | Return temperature reading as a float value in degrees C 
| colspan="2" | Return temperature reading as a float value in degrees C 
Line 110: Line 110:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Configures the I2C peripheral and puts the sensor into one shot mode ready to be sampled. Must be called before calling any of the other component macros. Returns 1 if the sensor has been intialised correctly, else returns 0. 
| colspan="2" | Configures the I2C peripheral and puts the sensor into one shot mode ready to be sampled. Must be called before calling any of the other component macros. Returns 1 if the sensor has been intialised correctly, else returns 0. 
Line 125: Line 125:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
Line 166: Line 166:
| colspan="2" | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not  a 10ms delay between an I2C stop event and the next I2C start event.  Most modern microcontrollers will not have a problem so this property can be disabled to speed up the  I2C communications.  
| colspan="2" | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not  a 10ms delay between an I2C stop event and the next I2C start event.  Most modern microcontrollers will not have a problem so this property can be disabled to speed up the  I2C communications.  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-
|-
|-

Latest revision as of 14:37, 13 July 2026

Author Matrix TSL
Version 2.0
Category Environmental


Temp / Humidity (SHT31) component

Humidity and temperature sensor using an SHT31 IC connected via I2C. On screen GUI allows temperature and humidity values to be simulated, and will show all I2C communication in a console window.

Detailed description

No detailed description exists yet for this component

Examples

An example displaying real temperatures and humidity using floats,

SHT31 Example

Macro reference

GetHumidityInt

GetHumidityInt
returns the relative Humidity reading as an integer value 
- INT Return


GetHumidityReal

GetHumidityReal
returns the Humidity reading as a float value 
- FLOAT Return


GetTemperatureInt

GetTemperatureInt
Return temperature reading as an integer value in degrees C 
- INT Return


GetTemperatureReal

GetTemperatureReal
Return temperature reading as a float value in degrees C 
- FLOAT Return


Initialise

Initialise
Configures the I2C peripheral and puts the sensor into one shot mode ready to be sampled. Must be called before calling any of the other component macros. Returns 1 if the sensor has been intialised correctly, else returns 0. 
- BYTE Return


Property reference

Properties
Address
Selects the correct device address based on the ADDR pin connection to VDD or VSS. 
Channel
Channel selection 
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Simulation
Simulation Comms
 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Humidity_SHT31.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Humidity_SHT31.fcfx