|
24 | 24 |
|
25 | 25 | #include "SparkFun_AS7331.h"
|
26 | 26 |
|
27 |
| -SfeAS7331ArdI2C myUVSensor; |
| 27 | +void setup() { |
28 | 28 |
|
29 |
| -int8_t result = SFE_BUS_OK; |
| 29 | +} |
30 | 30 |
|
31 |
| -void setup() { |
32 |
| - Serial.begin(115200); |
33 |
| - while(!Serial){delay(100);}; |
34 |
| - Serial.println("UV LED Example."); |
| 31 | +void loop() { |
| 32 | + |
| 33 | +} |
35 | 34 |
|
36 |
| - // Initialize sensor and run default setup. |
37 |
| - if(myUVSensor.begin() == false) { |
38 |
| - Serial.println("Sensor failed to begin. Please check your wiring!"); |
39 |
| - Serial.println("Spinning..."); |
40 |
| - while(1); |
41 |
| - } |
| 35 | +// SfeAS7331ArdI2C myUVSensor; |
42 | 36 |
|
43 |
| - Serial.println("Sensor began."); |
| 37 | +// int8_t result = SFE_BUS_OK; |
44 | 38 |
|
45 |
| - // Set measurement mode and change device operating mode to measure. |
46 |
| - if(myUVSensor.startMeasurement(MEAS_MODE_CMD) == false) { |
47 |
| - Serial.println("Sensor did not get set properly."); |
48 |
| - Serial.println("Spinning..."); |
49 |
| - while(1); |
50 |
| - } |
| 39 | +// void setup() { |
| 40 | +// Serial.begin(115200); |
| 41 | +// while(!Serial){delay(100);}; |
| 42 | +// Serial.println("UV LED Example."); |
51 | 43 |
|
52 |
| - Serial.println("Set mode to command."); |
| 44 | +// // Initialize sensor and run default setup. |
| 45 | +// if(myUVSensor.begin() == false) { |
| 46 | +// Serial.println("Sensor failed to begin. Please check your wiring!"); |
| 47 | +// Serial.println("Spinning..."); |
| 48 | +// while(1); |
| 49 | +// } |
53 | 50 |
|
54 |
| -} |
| 51 | +// Serial.println("Sensor began."); |
55 | 52 |
|
56 |
| -void loop() { |
| 53 | +// // Set measurement mode and change device operating mode to measure. |
| 54 | +// if(myUVSensor.startMeasurement(MEAS_MODE_CMD) == false) { |
| 55 | +// Serial.println("Sensor did not get set properly."); |
| 56 | +// Serial.println("Spinning..."); |
| 57 | +// while(1); |
| 58 | +// } |
| 59 | + |
| 60 | +// Serial.println("Set mode to command."); |
| 61 | + |
| 62 | +// } |
| 63 | + |
| 64 | +// void loop() { |
57 | 65 |
|
58 |
| - // Send a start measurement command. |
59 |
| - if(SFE_BUS_OK != myUVSensor.setStartStateMode(START_STATE_ENABLED)) |
60 |
| - Serial.println("Error starting reading!"); |
| 66 | +// // Send a start measurement command. |
| 67 | +// if(SFE_BUS_OK != myUVSensor.setStartStateMode(START_STATE_ENABLED)) |
| 68 | +// Serial.println("Error starting reading!"); |
61 | 69 |
|
62 |
| - // Wait for a bit longer than the conversion time. |
63 |
| - delay(2+(1 << myUVSensor.getConfigConversionTime())); |
| 70 | +// // Wait for a bit longer than the conversion time. |
| 71 | +// delay(2+(1 << myUVSensor.getConfigConversionTime())); |
64 | 72 |
|
65 |
| - // Read UV values. |
66 |
| - if(SFE_BUS_OK != myUVSensor.readAllUV()) |
67 |
| - Serial.println("Error reading UV."); |
| 73 | +// // Read UV values. |
| 74 | +// if(SFE_BUS_OK != myUVSensor.readAllUV()) |
| 75 | +// Serial.println("Error reading UV."); |
68 | 76 |
|
69 |
| - Serial.print("UVA:"); |
70 |
| - Serial.print(myUVSensor.measures.uva); |
71 |
| - Serial.print(" UVB:"); |
72 |
| - Serial.print(myUVSensor.measures.uvb); |
73 |
| - Serial.print(" UVC:"); |
74 |
| - Serial.println(myUVSensor.measures.uvc); |
| 77 | +// Serial.print("UVA:"); |
| 78 | +// Serial.print(myUVSensor.measures.uva); |
| 79 | +// Serial.print(" UVB:"); |
| 80 | +// Serial.print(myUVSensor.measures.uvb); |
| 81 | +// Serial.print(" UVC:"); |
| 82 | +// Serial.println(myUVSensor.measures.uvc); |
75 | 83 |
|
76 |
| - delay(2000); |
| 84 | +// delay(2000); |
77 | 85 |
|
78 |
| -}; |
| 86 | +// }; |
0 commit comments