| Line 17... |
Line 17... |
| 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 4 |
| 21 |
|
21 |
|
| 22 |
|
- |
|
| 23 |
#define address 0x44 // A0 = L |
22 |
#define address 0x44 // A0 = L |
| 24 |
#define SENSE_VIS 0 |
23 |
#define SENSE_VIS 0 |
| 25 |
#define SENSE_IR 1 |
24 |
#define SENSE_IR 1 |
| 26 |
|
25 |
|
| 27 |
#define LIGHT_AUTORANGE 0 |
26 |
#define LIGHT_AUTORANGE 0 |
| Line 149... |
Line 148... |
| 149 |
Wire.endTransmission(); // stop transmitting |
148 |
Wire.endTransmission(); // stop transmitting |
| 150 |
|
149 |
|
| 151 |
return (1000.0/pow(2.0,16)*ret); |
150 |
return (1000.0/pow(2.0,16)*ret); |
| 152 |
} |
151 |
} |
| 153 |
|
152 |
|
| 154 |
char *ftoa(char *a, double f, int precision) |
- |
|
| 155 |
{ |
- |
|
| 156 |
long p[] = {0,10,100,1000,10000,100000,1000000,10000000,100000000}; |
- |
|
| 157 |
|
- |
|
| 158 |
char *ret = a; |
- |
|
| 159 |
long heiltal = (long)f; |
- |
|
| 160 |
itoa(heiltal, a, 10); |
- |
|
| 161 |
while (*a != '\0') a++; |
- |
|
| 162 |
*a++ = '.'; |
- |
|
| 163 |
long desimal = abs((long)((f - heiltal) * p[precision])); |
- |
|
| 164 |
itoa(desimal, a, 10); |
- |
|
| 165 |
return ret; |
- |
|
| 166 |
} |
- |
|
| 167 |
|
- |
|
| 168 |
void loop() |
153 |
void loop() |
| 169 |
{ |
154 |
{ |
| 170 |
float luxVIS=0; |
155 |
float luxVIS=0; |
| 171 |
float luxIR=0; |
156 |
float luxIR=0; |
| 172 |
float time; |
157 |
float time; |