Browse Source

Updated README.

main
David Antliff 8 years ago
parent
commit
580600aa53
  1. 2
      README.md
  2. 2
      components/esp32-owb
  3. 11
      main/app_main.c

2
README.md

@ -33,6 +33,8 @@ To run this example, connect one or more DS18B20 devices to a single GPIO on the
`make menuconfig` can be used to set the 1-Wire GPIO.
If you have several devices and see occasional CRC errors, consider using a 2.2 kOhm pull-up resistor instead. Also consider adding decoupling capacitors between the sensor supply voltage and ground, as close to each sensor as possible.
## Features
This example provides:

2
components/esp32-owb

@ -1 +1 @@
Subproject commit 57bcaf06f500953e3acb97d23c6a6a98712824ab
Subproject commit c62cd2e7fe0850b29e2563d1fde49ff452676b57

11
main/app_main.c

@ -44,6 +44,9 @@ void app_main()
{
esp_log_level_set("*", ESP_LOG_INFO);
/// stable readings require a brief period before communication
vTaskDelay(1000.0 / portTICK_PERIOD_MS);
// Create a 1-Wire bus
#ifdef USE_STATIC
OneWireBus owb_static; // static allocation
@ -132,6 +135,7 @@ void app_main()
// }
// read temperatures more efficiently by starting conversions on all devices at the same time
int crc_errors[MAX_DEVICES] = {0};
if (num_devices > 0)
{
while (1)
@ -156,7 +160,12 @@ void app_main()
printf("\nTemperature readings (degrees C):\n");
for (int i = 0; i < num_devices; ++i)
{
printf(" %d: %.1f\n", i, temps[i]);
if (temps[i] == DS18B20_INVALID_READING)
{
++crc_errors[i];
}
printf(" %d: %.1f %d errors\n", i, temps[i], crc_errors[i]);
}
// make up delay to approximately 1 second per measurement

Loading…
Cancel
Save