Created
September 5, 2012 04:06
-
-
Save brooksware2000/3630206 to your computer and use it in GitHub Desktop.
Test sketch for the TEMT6000 light sensor
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
/* | |
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where does the #include <TEMT6000.h> come from?