arduino-libraries / ArduinoIoTCloud

https://app.arduino.cc
Other
111 stars 78 forks source link

Version 2.0 plus Wire.h not working #466

Closed humphrey-b52 closed 5 months ago

humphrey-b52 commented 5 months ago

Platform: ESP32

pennam commented 5 months ago

Hi @humphrey-b52 could you provide a basic sketch to reproduce the issue. I'm UsingArduinoIoTCloud 2.0.0 and DS3232RTC 2.0.1 library and everything is working fine. Thanks

humphrey-b52 commented 5 months ago

Sure. Here is my sketch (thinned out):

/////////////////////////////////////////////////////
// Libraries 
/////////////////////////////////////////////////////

#include "arduino_secrets.h"    // WiFi SSID
#include "thingProperties.h"    // includes ArduinoIoTCloud.h, Arduino_ConnectionHandler.h
#include <Adafruit_NeoPixel.h>  // NeoPixel
#include <RTClib.h>             // for RTC
#include <Wire.h>               // for I2C communication

/////////////////////////////////////////////////////
// Global constants 
/////////////////////////////////////////////////////

// Set pin numbers
  #define ledPin 2        // pin of the internal LED
  #define pixelPin 33     // pin of the NeoPixel
  #define sdaPin 21       // pin of the I2C SDA
  #define sdcPin 22       // pin of the I2C SDC
  #define pixelNum 115    // number of linked NeoPixel

/////////////////////////////////////////////////////
// Global variables 
/////////////////////////////////////////////////////

// define NeoPixel
  Adafruit_NeoPixel pixel = Adafruit_NeoPixel(pixelNum, pixelPin, NEO_GRB + NEO_KHZ800);
  uint32_t pixelColor;      // packed color for NeoPixel
  uint16_t hue;             // color / 0-65535 / means 1 degree approx. 182
  uint8_t sat;              // saturation / 0-255
  uint8_t val;              // value aka brightness / 0-255

// define RTC
  RTC_DS3231 RTC;           // create RTC for the DS3231 RTC module

// Time & Date
  uint16_t year;
  uint8_t  month;
  uint8_t  day;
  uint8_t  weekday;
  uint8_t  hour;
  uint8_t  minute;
  uint8_t  second;

// ...

/////////////////////////////////////////////////////
// Setup 
/////////////////////////////////////////////////////

void setup() {

// initialize serial port
  Serial.begin(9600);
  delay(1000);

// properties generated by Arduino IoT Cloud
  initProperties();

// connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  setDebugMessageLevel(2); // default is 0 (only errors) - maximum is 4
  Serial.println("Arduino IoT Cloud started ...");
  ArduinoCloud.addCallback(ArduinoIoTCloudEvent::SYNC, updateTime); // event for updating time
  ArduinoCloud.printDebugInfo();

// initialize the NeoPixel library
  pixel.begin();

// start the I2C interface for RTC (after ArduinoCloud!)
  Wire.begin();

// initialize the RTC
  RTC.begin();

} // close setup

//////////////////////////////////

Please get back to me, if I can provide more information.

pennam commented 5 months ago

Hi @humphrey-b52 I've made some other tests based on the code you have published but i cannot find any issue. What is your problem? Board can't connect to Arduino Cloud ? or You are not able to read time / temperature from RTC?

Could you provide a basic sketch only using ArduinoCloud + RTClib that i can build and reproduce your issue? You can add your RTC code on top of this basic ArduinoCloud example

humphrey-b52 commented 5 months ago

I had a local messup with my libraries. False alarm. Issue is resolved. Thank you!