Rev 2258 Rev 2261
Line 15... Line 15...
15 #include <Wire.h> 15 #include <Wire.h>
16 #include <math.h> 16 #include <math.h>
17 #include <stdlib.h> 17 #include <stdlib.h>
18 #include <SD.h> 18 #include <SD.h>
19   19  
20 #define chipSelect 4 20 #define chipSelect 10 //PB2
21   21  
22 #define address 0x44 // A0 = L 22 #define address 0x44 // A0 = L
23   23  
24 #define LIGHT_ENABLE 1 24 #define LIGHT_ENABLE 1
25 #define LIGHT_DISABLE 0 25 #define LIGHT_DISABLE 0
Line 63... Line 63...
63 63
64 // see if the card is present and can be initialized: 64 // see if the card is present and can be initialized:
65 if (!SD.begin(chipSelect)) { 65 if (!SD.begin(chipSelect)) {
66 Serial.println("Card failed, or not present"); 66 Serial.println("Card failed, or not present");
67 // don't do anything more: 67 // don't do anything more:
68 return; 68 while(true);
69 } 69 }
70 Serial.println("card initialized."); 70 Serial.println("card initialized.");
71 Serial.print("searching for files..."); 71 Serial.print("searching for files...");
72 72
73 do 73 do
Line 201... Line 201...
201 201
202 case LIGHT_RANGE4: 202 case LIGHT_RANGE4:
203 range=64000; 203 range=64000;
204 break; 204 break;
205 } 205 }
206 return ((500000.0*range)/(180000.0*resolution)*ret); // calculate output value 206 return ((500000.0*range)/(510000.0*resolution)*ret); // calculate output value
207 } 207 }
208   208  
209 void loop() 209 void loop()
210 { 210 {
211 float luxVIS=0; 211 float luxVIS=0;
Line 248... Line 248...
248 } 248 }
249 // if the file isn't open, pop up an error: 249 // if the file isn't open, pop up an error:
250 else { 250 else {
251 Serial.print("error opening "); 251 Serial.print("error opening ");
252 Serial.println(filename); 252 Serial.println(filename);
-   253 while(true);
253 } 254 }
254 delay(2000); 255 delay(2000);
255 } 256 }
256   257