Initial revision
[wakeup.git] / ArduinoLDR / ArduinoLDR.ino
1 /*
2
3 Analog input A0 to measure an LDR
4
5 */
6
7 int sensorPin = A0;    // select the input pin for the potentiometer
8 int sensorValue = 0;  // variable to store the value coming from the sensor
9
10
11 void setup() {
12
13   
14    //Initialize serial and wait for port to open:
15   Serial.begin(9600); 
16   while (!Serial) {
17     ; // wait for serial port to connect. Needed for Leonardo only
18   }
19     // prints title with ending line break 
20   Serial.println("Serial port ready."); 
21 }
22
23 void loop() {
24   // read the value from the sensor:
25   sensorValue = analogRead(sensorPin);    
26
27   
28   // stop the program for <sensorValue> milliseconds:
29   delay(60000);          
30
31   // prints value as string as an ASCII-encoded decimal (base 10).
32   // Decimal is the  default format for Serial.print() and Serial.println(),
33   // so no modifier is needed:
34   Serial.println(sensorValue);    
35 }
36