GY-63_MS5611/libraries/MAX31850/examples/MAX31850_getAddress/MAX31850_getAddress.ino

61 lines
879 B
Arduino
Raw Normal View History

2022-11-16 14:52:35 -05:00
//
// FILE: MAX31850_getAddress.ino
// AUTHOR: Rob Tillaart
// PURPOSE: MAX31850 lib getAddress demo
#include "OneWire.h"
#include "MAX31850.h"
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
MAX31850 sensor(&oneWire);
DeviceAddress da;
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("MAX31850_LIB_VERSION: ");
Serial.println(MAX31850_LIB_VERSION);
Serial.print("\ngetAddress: ");
Serial.println(sensor.getAddress(da));
sensor.begin();
Serial.print("\ngetAddress: ");
Serial.println(sensor.getAddress(da));
if (!sensor.getAddress(da))
{
Serial.println("No address found!");
return;
}
Serial.print("Address: ");
for (uint8_t i = 0; i < 8; i++)
{
if (da[i] < 0x10) Serial.print('0');
Serial.print(da[i], HEX);
}
Serial.println();
}
void loop()
{
}
// -- END OF FILE --