Skip to content

Instantly share code, notes, and snippets.

@toygame
Last active July 25, 2019 07:35
Show Gist options
  • Save toygame/bfa0e24ce4153c45b1e668a510bec837 to your computer and use it in GitHub Desktop.
Save toygame/bfa0e24ce4153c45b1e668a510bec837 to your computer and use it in GitHub Desktop.
Test Module MAX44009 Ambient Light Sensor_Arduino2Day
#include "Wire.h"
#include "Max44009.h"
Max44009 myLux(0x4A);
uint32_t lastDisplay = 0;
void setup()
{
Serial.begin(115200);
Serial.println(">>>>>>>>>Start MAX44009<<<<<<<<<<");
}
void loop()
{
if (millis() - lastDisplay >= 1000)
{
lastDisplay += 1000;
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);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment