Skip to content

Instantly share code, notes, and snippets.

@penpencool
Last active June 24, 2019 05:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save penpencool/f3f3af5abca5690de22a6b7b10d3736c to your computer and use it in GitHub Desktop.
Save penpencool/f3f3af5abca5690de22a6b7b10d3736c to your computer and use it in GitHub Desktop.
//Example By ArduinoAll
#include <Wire.h>
#include "i2c.h"
#include "i2c_MAX44009.h"
MAX44009 lux;
// สำหรับอุปกรณ์ GY-49 https://www.arduinoall.com/p/2178
// Arduino Uno GY-49 Example By ArduinoAll
// VIN - 3.3V
// GND - GND
// SCL - A5
// SDA - A4
unsigned long mLux_value;
void setup()
{
Serial.begin(9600);
if (lux.initialize()) Serial.println("Sensor found");
else
{
Serial.println("Sensor missing");
while (1) { };
}
}
void loop()
{
lux.getMeasurement(mLux_value);
Serial.print("mLUX: ");
Serial.print(mLux_value);
Serial.println(" ");
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment