Ich erlaube es mir mal, für die Tabletuser lesbar zu machen:
/**********************
Include Libraries // Arduino IDE Version Windows10 Vers 1.8.5
**********************/
#include <OneWire.h> // Version 2.3.3 http://www.pjrc.com/teensy/td_libs_OneWire.html
#include <DallasTemperature.h> // Version 3.7.7 http://www.pjrc.com/teensy/td_libs_OneWire.html
/****************************************
Define Constants
****************************************/
#define ONE_WIRE_BUS 22 // Data wire is plugged into GPIO 22 on the 2560
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress Sensor1_ADR = { 0x28, 0x81, 0x53, 0xD0, 0x04, 0x00, 0x00, 0x87 };
DeviceAddress Sensor2_ADR = { 0x28, 0xF1, 0x05, 0x5A, 0x05, 0x00, 0x00, 0x7F };
DeviceAddress Sensor3_ADR = { 0x28, 0xC8, 0xB8, 0xD0, 0x04, 0x00, 0x00, 0xCE };
//****************************
//* oneWire Search Problem *
//****************************
void SensorVorhanden()
{
if (!oneWire.search(Sensor1_ADR)) Serial.println("Can not find: Sensor1_ADR");
if (!oneWire.search(Sensor2_ADR)) Serial.println("Can not find: Sensor2_ADR");
if (!oneWire.search(Sensor3_ADR)) Serial.println("Can not find: Sensor3_ADR");
}
void SensorAdressenDrucken() {
printAddress(Sensor1_ADR);
printAddress(Sensor2_ADR);
printAddress(Sensor3_ADR);
}
//**************************************
//* function to print a device address *
//**************************************
void printAddress(DeviceAddress deviceAddress)
{
for (uint8_t i = 0; i < 8; i++)
{
if (deviceAddress[i] < 16) Serial.print("0");
Serial.print(deviceAddress[i], HEX);
Serial.print(" ");
}
Serial.println();
}
void setup(void)
{
Serial.begin(9600);
delay(1000);
sensors.begin();
delay(1000);
SensorAdressenDrucken();
Serial.println();
SensorVorhanden();
Serial.println();
SensorAdressenDrucken();
}
void loop(void)
{
}