30 lines
654 B
C
Raw Normal View History

2024-05-20 17:30:46 +03:00
#include "zh_onewire.h"
void app_main(void)
{
uint8_t *rom = NULL;
zh_onewire_init(GPIO_NUM_5);
if (zh_onewire_reset() != ESP_OK)
{
printf("There are no 1-Wire devices available on the bus.\n");
}
else
{
zh_onewire_search_rom_init();
for (;;)
{
rom = zh_onewire_search_rom_next();
if (rom == NULL)
{
break;
}
printf("Found device ROM: ");
for (uint8_t i = 0; i < 8; ++i)
{
printf("%X ", *(rom++));
}
rom -= 8;
printf("\n");
}
}
}