Hello,
No matter how I tinker with it, I only receive the following response from my efforts to connect a Grove Sunlight Sensor to an arduino Uno via a base shield V2.
14:45:50.992 -> Beginning Si1145!
14:45:51.030 -> Si1145 is not ready!
14:45:52.004 -> Si1145 is ready!
14:45:52.038 -> //--------------------------------------//
14:45:52.072 ->
14:45:52.072 -> Vis: 65535
14:45:52.072 -> IR: 65535
14:45:52.106 -> UV: 655.35
I've noticed that in the example sketches that it does not define where/how to determine which pins will be used out input/out.
I currently have the sensor hooked up to D3 on the base shield.
#include <Wire.h>
#include "Arduino.h"
#include "SI114X.h"
SI114X SI1145 = SI114X();
const int digital_light_sensor_pin = 3;// defined the sunlight sensor pin as digital pin 3
int light_value = 0;// Set the starting value as 0, this enables it to be defined with a baseline value
void setup() {
Wire.begin();
Serial.begin(9600); // begins after a delay
Serial.println("Beginning Si1145!"); // initiation statement
while (!SI1145.Begin()) { // appears to be that while if SI1145 isn't ready, don't begin. used to begin with a "while" statement, but it did not change for several minutes. It now immediately prints
// but the numbers are not valid
Serial.println("Si1145 is not ready!"); // accompanying statement
delay(1000); // delay
break;
}
Serial.println("Si1145 is ready!");
pinMode(digital_light_sensor_pin, OUTPUT);
//digitalWrite(digital_light_sensor_pin, HIGH);
//digitalWrite(9, HIGH);
}
void loop() {
light_value = digitalRead(digital_light_sensor_pin); // have not yet been able to determine how it is that you assign where the data is supposed to come from
digitalWrite(digital_light_sensor_pin, HIGH);
Serial.println("//--------------------------------------//\r\n"); // borrowed from the SI114X example
Serial.print("Vis: "); Serial.println(SI1145.ReadVisible()); // borrowed from the SI114X example
Serial.print("IR: "); Serial.println(SI1145.ReadIR()); // borrowed from the SI114X example
//the real UV value must be div 100 from the reg value , datasheet for more information.
Serial.print("UV: "); Serial.println((float)SI1145.ReadUV()/100);// borrowed from the SI114X example
delay(1000);
}