Skip to content

Instantly share code, notes, and snippets.

@brooksware2000
Created September 5, 2012 04:06
Show Gist options
  • Save brooksware2000/3630206 to your computer and use it in GitHub Desktop.
Save brooksware2000/3630206 to your computer and use it in GitHub Desktop.
Test sketch for the TEMT6000 light sensor
/*
Demonstration sketch for TEMT6000 light sensor.
Reads light level (lux) and prints results to I2C LCD.
*/
#include <TEMT6000.h>
#include <LCD.h>
#include <Wire.h>
// TEMT6000 light sensor pin
#define TEMT6000_PIN A1
// Create object
TEMT6000 light_sensor;
// Default I2C address for LCD is 0
LCD lcd;
void setup() {
lcd.begin(20, 4);
light_sensor.init(TEMT6000_PIN);
lcd.clear();
lcd.print("TEMT6000 test");
}
void loop() {
// Basic readout test, just print the level as an int and float
lcd.setCursor(0,1);
lcd.print("Level: ");
lcd.print(light_sensor.get_lux_int());
lcd.print("%");
lcd.setCursor(0,2);
lcd.print("Level: ");
lcd.print(light_sensor.get_lux_float());
lcd.print("%");
delay(1000);
}
@ctron
Copy link

ctron commented Aug 30, 2013

Where does the #include <TEMT6000.h> come from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment