adafruit / Adafruit_APDS9960

Arduino drivers for APDS9960 gesture sensor
Other
37 stars 45 forks source link

Can you please provide an example of how to use Wire's setPins? #25

Closed githufsb closed 3 years ago

githufsb commented 3 years ago

WRT https://github.com/espressif/arduino-esp32/issues/3779

Possible to add an example of how to use new setPins function in ESP32 Wire.h?

Thanks!

githufsb commented 3 years ago

Further info....tried to use existing example, and I'm getting this error. Bit of a newb, so sorry if i'm doing something wrong.

[E][Wire.cpp:64] setPins(): can not set pins if begin was already called


#include <Arduino.h>
#include <Wire.h>

#include "Adafruit_APDS9960.h"

//#define GEST_I2C_ADDRESS  0x39
//#define GEST_I2C_SDA      5
//#define GEST_I2C_SCL      4

Adafruit_APDS9960 apds;

void gesture_init()
{
  //TwoWire *_wire = &Wire;
  //_wire->setPins(5,4);

  Wire.setPins(5,4);

  if(!apds.begin()){
    DPRINT("failed to initialize Gesture device! Please check your wiring.\n");
  }
  else DPRINT("Gesture Device initialized!\n");
...
ladyada commented 3 years ago

please post to the espressif forums for tech support heelp :)