Examples - Sensorboard - Ambient Light
Ambient Light
This Example shows the use of an ambient light sensor. Connect the sensor to an analog pin.
/************************************************************************************************** * * Ambient Light Sensor TEMT6000 * * Version: 1.0.0 - Januar 2009 * Author: Etienne Ribeiro / tutorial assistant caad / eribeiro[at]ethz.ch * Supervisor: Christoph Wartmann / chair for caad - ETH Zürich / wartmann[at].arch.ethz.ch * * Desc: Shows the use of a Ambient Light Sensor TEMT6000 on analog pin. * ***************************************************************************************************/ // // Const int analogPin = 0; // // Setup void setup() { // LED (2 * blink) pinMode(48, OUTPUT); digitalWrite(48, HIGH); delay(200); digitalWrite(48, LOW); delay(200); digitalWrite(48, HIGH); // Serial Serial.begin(9600); // sets the serial port to 9600 } // // Loop void loop() { int val = analogRead(analogPin); Serial.print(val, DEC); Serial.print(" "); delay(50); }