Hardware Reference
In-Depth Information
Now that your library has been imported, you can use it. It becomes available
immediately and is listed in the Import Library menu. This library also adds
an example, available for use immediately in the File
Examples menu. Note
that for both the Import Library and the Example menu items, external libraries
are separated from standard libraries.
Now, load the Si1145 example sketch shown here:
1 /***************************************************
2 This is a library for the Si1145 UV/IR/Visible Light Sensor
3
4 Designed specifically to work with the Si1145 sensor in the
5 adafruit shop
6 ----> https://www.adafruit.com/products/1777
7
8 These sensors use I2C to communicate, 2 pins are required to
9 interface
10 Adafruit invests time and resources providing this open source
code,
11 please support Adafruit and open-source hardware by purchasing
12 products from Adafruit!
13
14 Written by Limor Fried/Ladyada for Adafruit Industries.
15 BSD license, all text above must be included in any redistribution
16 ****************************************************/
17
18 #include <Wire.h>
19 #include "Adafruit_SI1145.h"
20
21 Adafruit_SI1145 uv = Adafruit_SI1145();
22
23 void setup() {
24 Serial.begin(9600);
25
26 Serial.println("Adafruit SI1145 test");
27
28 if (! uv.begin()) {
29 Serial.println("Didn't find Si1145");
30 while (1);
31 }
32
33 Serial.println("OK!");
34 }
35
36 void loop() {
37 Serial.println("===================");
38 Serial.print("Vis: "); Serial.println(uv.readVisible());
39 Serial.print("IR: "); Serial.println(uv.readIR());
40
41 // Uncomment if you have an IR LED attached to LED pin!
42 //Serial.print("Prox: "); Serial.println(uv.readProx());
Search WWH ::




Custom Search