GY-63_MS5611/libraries/MAX44007/examples/max44007_test01/max44007_test01.ino
2022-01-05 16:46:06 +01:00

51 lines
761 B
C++

//
// FILE: Max44007_test01.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo of Max44007 library
// DATE: 2022-01-04
#include "Wire.h"
#include "Max44007.h"
Max44007 myLux(0x5A);
uint32_t lastDisplay = 0;
void setup()
{
Serial.begin(115200);
Serial.print("Start Max44007_test01 : ");
Serial.println(MAX44007_LIB_VERSION);
Wire.begin();
Wire.setClock(100000);
}
void loop()
{
uint32_t interval = 1000;
if (millis() - lastDisplay >= interval)
{
lastDisplay += interval;
float lux = myLux.getLux();
int err = myLux.getError();
if (err != 0)
{
Serial.print("Error:\t");
Serial.println(err);
}
else
{
Serial.print("lux:\t");
Serial.println(lux);
}
}
}
// -- END OF FILE --