Hi, I get compiling error when using the APDS9960 gesturetest example on a nano every, I have installed the right board and library. When using the Arduino-APDS9960 it’s ok and I get data from the chip.
This is the error I get:
...
c:\Users\mike\Documents\Arduino\libraries\SparkFun_APDS9960_RGB_and_Gesture_Sensor\src\SparkFun_APDS9960.cpp: In member function ‘int SparkFun_APDS9960::wireReadDataBlock(uint8_t, uint8_t*, unsigned int)’:
c:\Users\mike\Documents\Arduino\libraries\SparkFun_APDS9960_RGB_and_Gesture_Sensor\src\SparkFun_APDS9960.cpp:2204:44: error: call of overloaded ‘requestFrom(int, unsigned int&)’ is ambiguous
Wire.requestFrom(APDS9960_I2C_ADDR, len);
^
In file included from c:\Users\mike\Documents\Arduino\libraries\SparkFun_APDS9960_RGB_and_Gesture_Sensor\src\SparkFun_APDS9960.cpp:20:0:
C:\Users\mike\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h:61:12: note: candidate: virtual size_t TwoWire::requestFrom(uint8_t, size_t)
size_t requestFrom(uint8_t, size_t);
^~~~~~~~~~~
C:\Users\mike\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\libraries\Wire\src/Wire.h:63:12: note: candidate: size_t TwoWire::requestFrom(int, int)
size_t requestFrom(int, int);
^~~~~~~~~~~
// Pins #define APDS9960_INT 2 // Needs to be an interrupt pin
// Constants
// Global Variables
SparkFun_APDS9960 apds = SparkFun_APDS9960();
int isr_flag = 0;
void setup() {
// Set interrupt pin as input
pinMode(APDS9960_INT, INPUT);
// Initialize Serial port
Serial.begin(9600);
Serial.println();
Serial.println(F("--------------------------------"));
Serial.println(F("SparkFun APDS-9960 - GestureTest"));
Serial.println(F("--------------------------------"));
// Initialize interrupt service routine
attachInterrupt(0, interruptRoutine, FALLING);
// Initialize APDS-9960 (configure I2C and initial values)
if ( apds.init() ) {
Serial.println(F("APDS-9960 initialization complete"));
} else {
Serial.println(F("Something went wrong during APDS-9960 init!"));
}
// Start running the APDS-9960 gesture sensor engine
if ( apds.enableGestureSensor(true) ) {
Serial.println(F("Gesture sensor is now running"));
} else {
Serial.println(F("Something went wrong during gesture sensor init!"));
}
}
Nice, why do they sell it ? It is an original adafruit thingy, one would expect it is supported.
I have a nano ESP32, would this be more compatible ? Or should I order something else ?
It is supported. Since a Nano every based on different MCU than a classic one - the boards work with different libraries, it is an absolutely normal.
I can't say for this library, but in general the Nano esp32 has a microcontroller that is not compatible in commands with either the classic Nano or the Every.
If you using an arduino already, why to change the board?
In general, it is a good idea to make a google search like "APDS9960 + arduino nano every" to look if there are any feedback from someone who used the same setup.
I'm using a library of a 3th party that was made for Arduino. The other examples included in the library work. I can use the Arduino library for 9960 chip, but that doesn't support al gestures.
It is worth understanding that Arduino is not a kettle that you plug into a socket and it works.
This is a constructor that is designed for you to be able to create your own circuits and write code for the devices that you design.
If you do not know how to do this, it is better to buy a ready-made device
It is wise to use Adafruit libraries with Adafruit products, and Sparkfun libraries with Sparkfun products, as both companies support their own products, and host customer support forums.
It is also very wise to check which processors are compatible with a given library.