Alex1603 wrote: Fri Oct 31, 2025 9:07 pm Zagdza się - Bad Königsdorff-Jastrzemb, ale odnośnie supli - podeślijcie jakiś przykład z dwoma dsami - adresy są więc będzie łatwiej
Code: Select all
// Czytnik numerów seryjnych czujników DS18B20
#include <OneWire.h>
const byte ONEWIRE_PIN = 4;
OneWire onewire(ONEWIRE_PIN);
void setup()
{
// while (!Serial)
// ;
Serial.begin(115200);
}
void loop()
{
byte address[8];
onewire.reset_search();
while (onewire.search(address))
{
if (address[0] != 0x28)
continue;
if (OneWire::crc8(address, 7) != address[7])
{
Serial.println(F("Błędny adres, sprawdz polaczenia"));
break;
}
for (byte i = 0; i < 8; i++)
{
Serial.print(F("0x"));
Serial.print(address[i], HEX);
if (i < 7)
Serial.print(F(", "));
}
Serial.println();
}
while (1)
;
}