|
18 | 18 |
|
19 | 19 | You should have received a copy of the GNU General Public License |
20 | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 | | -
|
22 | | -
|
23 | | - ---AVAILABLE FUNCTIONS--- |
24 | | - AS726X(TwoWire &wirePort = Wire, byte gain = 3, byte measurementMode = 3); |
25 | | - void takeMeasurements(); |
26 | | - void takeMeasurementsWithBulb(); |
27 | | - void printMeasurements(); |
28 | | - void printUncalibratedMeasurements(); |
29 | | - byte getTemperature(); |
30 | | - float getTemperatureF(); |
31 | | - void setMeasurementMode(byte mode); |
32 | | - boolean dataAvailable(); |
33 | | - void enableIndicator(); |
34 | | - void disableIndicator(); |
35 | | - void setIndicatorCurrent(byte current); |
36 | | - void enableBulb(); |
37 | | - void disableBulb(); |
38 | | - void setBulbCurrent(byte current); |
39 | | - void softReset(); |
40 | | - void setGain(byte gain); |
41 | | - void setIntegrationTime(byte integrationValue); |
42 | | - void enableInterrupt(); |
43 | | - void disableInterrupt(); |
44 | | -
|
45 | | -
|
46 | | - //Get the various color readings |
47 | | - int getViolet(); |
48 | | - int getBlue(); |
49 | | - int getGreen(); |
50 | | - int getYellow(); |
51 | | - int getOrange(); |
52 | | - int getRed(); |
53 | | -
|
54 | | - //Get the various NIR readings |
55 | | - int getR(); |
56 | | - int getS(); |
57 | | - int getT(); |
58 | | - int getU(); |
59 | | - int getV(); |
60 | | - int getW(); |
61 | | -
|
62 | | - //Returns the various calibration data |
63 | | - float getCalibratedViolet(); |
64 | | - float getCalibratedBlue(); |
65 | | - float getCalibratedGreen(); |
66 | | - float getCalibratedYellow(); |
67 | | - float getCalibratedOrange(); |
68 | | - float getCalibratedRed(); |
69 | | -
|
70 | | - float getCalibratedR(); |
71 | | - float getCalibratedS(); |
72 | | - float getCalibratedT(); |
73 | | - float getCalibratedU(); |
74 | | - float getCalibratedV(); |
75 | | - float getCalibratedW(); |
76 | 21 | */ |
| 22 | + |
77 | 23 | #include "AS726X.h" |
78 | | -AS726X sensor; |
| 24 | +AS726X sensor;//Creates the sensor object |
79 | 25 | byte GAIN = 0; |
80 | 26 | byte MEASUREMENT_MODE = 0; |
81 | 27 |
|
82 | 28 | void setup() { |
83 | | - sensor.begin(Wire, GAIN, MEASUREMENT_MODE); |
84 | | -/*//You can also create an instance that runs on a different port (For instance, if you are using a teensy). The Gain and Measurement mode can also be changed. |
85 | | - //Uncomment the below code and comment the above call of "sensor.begin()" to customize these settings. |
86 | | - byte GAIN = 3; |
87 | | - //Sets the gain |
88 | | - //Sets the gain value |
89 | | - //Gain 0: 1x (power-on default) |
90 | | - //Gain 1: 3.7x |
91 | | - //Gain 2: 16x |
92 | | - //Gain 3: 64x |
93 | | - byte MEASUREMENT_MODE = 3; |
94 | | - //Sets the measurement mode |
95 | | - //Mode 0: Continuous reading of VBGY (7262) / STUV (7263) |
96 | | - //Mode 1: Continuous reading of GYOR (7262) / RTUX (7263) |
97 | | - //Mode 2: Continuous reading of all channels (power-on default) |
98 | | - //Mode 3: One-shot reading of all channels |
99 | | - sensor.begin(Wire, GAIN, MEASUREMENT_MODE); |
100 | | - //New declaration of sensor with different values |
101 | | -*/ |
| 29 | + sensor.begin(Wire, GAIN, MEASUREMENT_MODE);//Initializes the sensor with non default values |
102 | 30 | } |
103 | 31 |
|
104 | 32 | void loop() { |
105 | 33 | sensor.takeMeasurements(); |
106 | | - sensor.printMeasurements();//Prints out all measurements (calibrated) |
| 34 | + sensor.printMeasurements(); |
107 | 35 | } |
0 commit comments