GY-63_MS5611/libraries/MAX14661/examples/MAX14661_isConnected/MAX14661_isConnected.ino

54 lines
869 B
Arduino
Raw Normal View History

2021-06-03 03:31:17 -04:00
//
// FILE: MAX14661_isConnected.ino
// AUTHOR: Rob Tillaart
// PURPOSE: test MAX14661 lib
// DATE: 2021-01-29
// URL: https://github.com/RobTillaart/MAX14661
//
2021-12-21 07:06:15 -05:00
// test behaviour when device is not connected and reconnected again.
2021-06-03 03:31:17 -04:00
// E.g. simulate loose wires..
#include "Wire.h"
#include "MAX14661.h"
MAX14661 mux(0x4C); // 0x4C..0x4F
bool connected = false;
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.println(MAX14661_LIB_VERSION);
if (mux.begin() == false)
{
Serial.println("Could not find MAX14661");
}
Serial.println("end of setup()");
}
2021-12-21 07:06:15 -05:00
2021-06-03 03:31:17 -04:00
void loop()
{
if (!connected && mux.isConnected())
{
connected = true;
Serial.print(millis());
Serial.println("\tconnected");
}
if (connected && !mux.isConnected())
{
connected = false;
}
delay(1000);
}
// -- END OF FILE --
2021-12-21 07:06:15 -05:00