Improved documentation of SHT3x driver examples

This commit is contained in:
Gunar Schorcht 2017-10-01 01:44:25 +02:00 committed by GitHub
parent 611e3411c2
commit c4248581e2

View file

@ -10,22 +10,43 @@ There are examples for only one sensor and examples for two sensors.
To run examples with **one sensor**, just use GPIO5 (SCL) and GPIO4 (SDA) to connect to the SHT3x sensor's I2C interface. To run examples with **one sensor**, just use GPIO5 (SCL) and GPIO4 (SDA) to connect to the SHT3x sensor's I2C interface.
```
+------------------------+ +--------+
| ESP8266 Bus 0 | | BME680 |
| GPIO 5 (SCL) +---->+ SCL |
| GPIO 4 (SDA) +-----+ SDA |
| | +--------+
+------------------------+
```
If you want to run examples with **two sensors**, you could do this with only one bus and different I2C addresses or with two buses and the same or different I2C addresses. In later case, use GPIO16 (SCL) and GPIO14 (SDA) for the second bus to connect to the second SHT3x sensor's I2C interface. If you want to run examples with **two sensors**, you could do this with only one bus and different I2C addresses or with two buses and the same or different I2C addresses. In later case, use GPIO16 (SCL) and GPIO14 (SDA) for the second bus to connect to the second SHT3x sensor's I2C interface.
```
+------------------------+ +----------+
| ESP8266 Bus 0 | | BME680_1 |
| GPIO 5 (SCL) ------> SCL |
| GPIO 4 (SDA) ------- SDA |
| | +----------+
| Bus 1 | | BME680_2 |
| GPIO 12 (SCL) ------> SCL |
| GPIO 14 (SDA) ------- SDA |
+------------------------+ +----------+
```
## Example description ## Example description
__*shtx_callback_one_sensor*__ ### _shtx_callback_one_sensor_
This example shows how to use a **callback function** to get the results of periodic measurements of only **one sensor** with a period of 1000 ms. It includes some simple error handling. This example shows how to use a **callback function** to get the results of periodic measurements of only **one sensor** with a period of 1000 ms. It includes some simple error handling.
__*shtx_callback_two_sensors*__ ### _shtx_callback_two_sensors_
This example shows how to use a **callback function** to get the results of periodic measurements of **two sensors** with **different measurement periods** of 1000 ms and 5000 ms, respectively. The sensors are connected to **two different buses**. There is no error handling in this example. This example shows how to use a **callback function** to get the results of periodic measurements of **two sensors** with **different measurement periods** of 1000 ms and 5000 ms, respectively. The sensors are connected to **two different buses**. There is no error handling in this example.
__*shtx_task_one_sensor*__ ### _shtx_task_one_sensor_
This example shows how to use a **task** in conjunction with function __*sht3x_get_values*__ to get the results of periodic measurements of only **one sensor** with a period of 1000 ms. The task uses function *vTaskDelay* to realize a periodic exudation of function *sht3x_get_values* with same rate as periodic measurements. There is no error handling in this example. This example shows how to use a **task** in conjunction with function **_sht3x_get_values_** to get the results of periodic measurements of only **one sensor** with a period of 1000 ms. The task uses function **_vTaskDelay_** to realize a periodic exudation of function **_sht3x_get_values_** with same rate as periodic measurements. There is no error handling in this example.
__*shtx_timer_one_sensor*__ ### _shtx_timer_one_sensor_
This example shows how to use a **software timer** and **timer callback function** in conjunction with function __*sht3x_get_values*__ to get the results of periodic measurements of only **one sensor** with a period of 1000 ms. The timer callback function executes function *sht3x_get_values* to get the results of periodic measurements. The timer is started with same period as periodic measurements. Thus, the timer callback function is executed at same rate as periodic measurements. There is no error handling in this example. This example shows how to use a **software timer** and **timer callback function** in conjunction with function **_sht3x_get_values_** to get the results of periodic measurements of only **one sensor** with a period of 1000 ms. The timer callback function executes function **_sht3x_get_values_** to get the results of periodic measurements. The timer is started with same period as periodic measurements. Thus, the timer callback function is executed at same rate as periodic measurements. There is no error handling in this example.