Line 81... |
Line 81... |
81 |
} |
81 |
} |
82 |
|
82 |
|
83 |
void led_blink() |
83 |
void led_blink() |
84 |
{ |
84 |
{ |
85 |
digitalWrite(3, HIGH); // set the LED on |
85 |
digitalWrite(3, HIGH); // set the LED on |
86 |
delay(500); |
86 |
delay(100); |
87 |
digitalWrite(3, LOW); // set the LED off |
87 |
digitalWrite(3, LOW); // set the LED off |
88 |
delay(500); |
- |
|
89 |
} |
88 |
} |
90 |
|
89 |
|
91 |
/*int light_sensor_write( unsigned int data, unsigned int address) |
90 |
/*int light_sensor_write( unsigned int data, unsigned int address) |
92 |
{ |
91 |
{ |
93 |
} |
92 |
} |
Line 211... |
Line 210... |
211 |
{ |
210 |
{ |
212 |
float luxVIS=0; |
211 |
float luxVIS=0; |
213 |
float luxIR=0; |
212 |
float luxIR=0; |
214 |
float time; |
213 |
float time; |
215 |
|
214 |
|
216 |
set_light_sensor(LIGHT_ENABLE, LIGHT_ONETIME, LIGHT_SENSE_VIS, LIGHT_INTERNAL_16, LIGHT_RANGE2); //setup sensor for visible measuring |
215 |
set_light_sensor(LIGHT_ENABLE, LIGHT_ONETIME, LIGHT_SENSE_VIS, LIGHT_INTERNAL_16, LIGHT_RANGE1); //setup sensor for visible measuring |
217 |
led_blink(); // Delay for measurement |
216 |
led_blink(); // Delay for measurement |
- |
|
217 |
delay(500); |
218 |
luxVIS=get_light_measurement(); |
218 |
luxVIS=get_light_measurement(); |
219 |
|
219 |
|
220 |
time=millis()/1000.0; |
220 |
time=millis()/1000.0; |
221 |
|
221 |
|
222 |
set_light_sensor(LIGHT_ENABLE, LIGHT_ONETIME, LIGHT_SENSE_IR, LIGHT_INTERNAL_16, LIGHT_RANGE2); // setup sensor for infrared measuring |
222 |
set_light_sensor(LIGHT_ENABLE, LIGHT_ONETIME, LIGHT_SENSE_IR, LIGHT_INTERNAL_16, LIGHT_RANGE1); // setup sensor for infrared measuring |
223 |
led_blink(); // Delay for measurement |
223 |
led_blink(); // Delay for measurement |
- |
|
224 |
delay(500); |
224 |
luxIR=get_light_measurement(); |
225 |
luxIR=get_light_measurement(); |
225 |
|
226 |
|
226 |
// open the file. note that only one file can be open at a time, |
227 |
// open the file. note that only one file can be open at a time, |
227 |
// so you have to close this one before opening another. |
228 |
// so you have to close this one before opening another. |
228 |
File dataFile = SD.open(filename, FILE_WRITE); |
229 |
File dataFile = SD.open(filename, FILE_WRITE); |
Line 247... |
Line 248... |
247 |
} |
248 |
} |
248 |
// if the file isn't open, pop up an error: |
249 |
// if the file isn't open, pop up an error: |
249 |
else { |
250 |
else { |
250 |
Serial.print("error opening "); |
251 |
Serial.print("error opening "); |
251 |
Serial.println(filename); |
252 |
Serial.println(filename); |
252 |
} |
253 |
} |
- |
|
254 |
delay(2000); |
253 |
} |
255 |
} |
254 |
|
256 |
|