Got an Arduino nano BLE sense, using the light sensor.
This code working :
#include <Arduino_APDS9960.h>
void setup() {
Serial.begin(9600);
APDS.begin();
}
void loop() {
if (APDS.colorAvailable()){
int r, g, b, alpha;
APDS.readColor(r, g, b, alpha);
Serial.print("alpha: ");
Serial.println(alpha);
}
delay(100);
}
I want to send alpha value to an other Arduino by I2C protocol.
After connecting the other board and verify the communication is valid, I get this code:
#include <Arduino_APDS9960.h>
#include <Wire.h>
void setup() {
Serial.begin(9600);
APDS.begin();
Wire.begin(); // Begin Wire as master ...
}
void loop() {
if (APDS.colorAvailable()){
int r, g, b, alpha;
APDS.readColor(r, g, b, alpha);
Wire.beginTransmission(10);
Wire.write(alpha);
Wire.endTransmission();
}
delay(100);
}
With the above code, the condition APDS.colorAvailable() is never True.
I don't know why ... Probably because I instantiate the Wire library ?