Hardware Reference
In-Depth Information
sometimes several. This is the case with the SI1145 written by Ladyada, Adafruit's
founder. Here is an extract of her example sketch:
Float UVindex = uv.readUV();
// the index is multiplied by 100 so to get the
// integer index, divide by 100!
UV index /= 100.0;
Serial.print("US: "); Serial.println(UVindex);
Figure 24-3: Importing the Si1145 library
This example code is extremely simple. A single function is called: readUV .
Ladyada also explains why the returned data is divided by 100. This function
is called on a uv object. This object is created at the beginning of the sketch, as
follows:
Adafruit_SI1145 uv = Adafruit_SI1145();
After that, another function is called inside the setup() function:
uv.begin();
And that's it. Everything you need to use the SI1145.
Search WWH ::




Custom Search