Reference
Last revision 2026/01/21
Library
- DFRobot RTU library
- DFRobot_EnvironmentalSensor Library (V1.0)
- DFRobot_EnvironmentalSensor Library (V2.0)
- (About how to install the library?)
Communication Protocol Description
The environmental sensor supports two communication methods, UART and I2C.
About UART/I2C mode switching:
- The default mode in the code is UART. Dial the switch to UART side to use it.
- For using I2C, dial the switch to I2C side and replace the 1 at the beginning of the code with 0, as shown below:
to 
API Description
/**
* @fn begin
* @brief Init SEN0500/SEN0501 sensor
* @return Return init status
* @retval 0 Succeed
* @retval -1 failed
*/
int8_t begin(void);
/**
* @fn getTemperature
* @brief Get SEN0500/SEN0501 temperature data
* @param units Temperature data unit select
* @n TEMP_C ℃
* @n TEMP_F ℉
* @return Return the obtained temperature data
*/
float getTemperature(uint8_t unist);
/**
* @fn getHumidity
* @brief Get SEN0500/SEN0501 humidity data
* @return Return the obtained humidity data
*/
float getHumidity(void);
/**
* @fn getUltravioletIntensity
* @brief Get SEN0500/SEN0501 UV intensity index data
* @return Return the obtained UV intensity index data
*/
float getUltravioletIntensity(void);
/**
* @fn getLuminousIntensity
* @brief Get SEN0500/SEN0501 luminous intensity data
* @return Return the obtained luminous intensity data
*/
float getLuminousIntensity(void);
/**
* @fn getAtmospherePressure
* @brief Get SEN0500/SEN0501 atmosphere pressure data
* @param units Atmosphere pressure data unit select
* @n HPA: Hectopascal
* @n KPA: Kilopascal
* @return Return the obtained atmosphere pressure data
*/
uint16_t getAtmospherePressure(uint8_t units);
/**
* @fn getElevation
* @brief Get SEN0500/SEN0501 altitude data
* @return Return the obtained altitude data
*/
float getElevation(void);
Other Supplementary Information
Was this article helpful?
