Last active
July 25, 2019 07:35
-
-
Save toygame/bfa0e24ce4153c45b1e668a510bec837 to your computer and use it in GitHub Desktop.
Test Module MAX44009 Ambient Light Sensor_Arduino2Day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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