[SOLVED] RTC widget is not working on my OAK

Dear friends,
first of all I confess that I know OAK is not on the supported hardware but it is working good in all other tests I performed, except RTC…

Well, I tried the bellow sketch that is based on blynk example slightly modified for OAK needs :

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h> /// I left it active but most probably does not need when OAK is used ///
/// #include <Ethernet.h> /// Not used in OAK ///
/// #include <BlynkSimpleEthernet.h> /// Not used in OAK ///
#include <BlynkSimpleOak.h>   /// OAK Specific ///
#include <SimpleTimer.h>
#include <Time.h>
#include <WidgetRTC.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "MyAuthTokenxxxxxx";

SimpleTimer timer;

WidgetRTC rtc;

BLYNK_ATTACH_WIDGET(rtc, V10)

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth);

  while (Blynk.connect() == false) {
    // Wait until connected
  }

  // Display digital clock every 10 seconds
  timer.setInterval(10000L, clockDisplay);
}

// Digital clock display of the time
void clockDisplay()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details
  BLYNK_LOG("Current time: %02d:%02d:%02d %02d %02d %d",
            hour(), minute(), second(),
            day(), month(), year());
}

void loop()
{
  Blynk.run();
  timer.run();
}

Of course I construct on my Android app (latest app version) with the correct auth an RTC widget and associated to V10.
On my arduino IDE 1.6.8, I have installed your latest blynk library.
Now what is the problem?
The compilation goes fine without any error BUT I see only the icon on my app screen. No time nothing else than the default icon…

Do you know why? What to test?

Please keep in mind that all the rest I have tried already (LED, Button, History Graph, Tabs) ALL are working as excepted. Poor madness !

Thanks for your time and the help offered.

Best Regards,
Mike Kranidis

Please try the latest version of the library, and also be sure to use the latest example code: https://github.com/blynkkk/blynk-library/blob/master/examples/Widgets/RTC/RTC.ino

Dear vhymanskyy,
thanks a lot for your fast answer. As you can see in my code above, yes I am using the “latest” example. Also I have the 3.4 library version that I suppose is the latest too.

What next to do/check ?

You’re definitely not using latest example code… You code doesn’t have rtc.begin();

Yes vhymanskyy, you are right and sorry for my mistake… I am a poor 50 something year old, be kind with me… :slight_smile:
I will test it and I will let you know!

Thanks again

Dear vhymanskyy,
I give up for today (it is already very late). Although I put the latest example, it didn’t work.
Is there any easy way to debug this problem? If yes, please tell me how.

Again thanks.
More comes tomorrow.

OAK is completely OK :wink:
BTW, where did you take the BlynkSimpleOak.h?
you could enable BLYNK_DEBUG to see the communication process.

Dear vhymanskyy, The file BlynkSimpleOak.h was distributed by digistump’s Arduino IDE standard installation BUT it did not work and needed a small hack that exeng introduced and THEN was working fine. See the file attached bellow for your reference.

Back to my problem, no mater what tests I did, RTC did not worked for me. Please elaborate how and where can I put the BLYNK_DEBUG to enable debugging and how can see the debug information?

Sorry I am not very familiar with Blynk yet but I have good plans to work with blynk in my forthcoming projects tho.

Best Regards,
Mike Kranidis

/**
 * @file       BlynkSimpleEsp8266.h
 * @author     Volodymyr Shymanskyy
 * @license    This project is released under the MIT License (MIT)
 * @copyright  Copyright (c) 2015 Volodymyr Shymanskyy
 * @date       Jan 2015
 * @brief
 *
 */

#ifndef BlynkSimpleEsp8266_h
#define BlynkSimpleEsp8266_h

#ifndef ESP8266
#error This code is intended to run on the ESP8266 platform! Please check your Tools->Board setting.
#endif

#ifndef BLYNK_INFO_DEVICE
#define BLYNK_INFO_DEVICE  "ESP8266"
#endif

#include <BlynkApiArduino.h>
#include <Blynk/BlynkProtocol.h>
#include <Adapters/BlynkArduinoClient.h>
#include <ESP8266WiFi.h>

class BlynkWifi
    : public BlynkProtocol<BlynkArduinoClient>
{
    typedef BlynkProtocol<BlynkArduinoClient> Base;
public:
    BlynkWifi(BlynkArduinoClient& transp)
        : Base(transp)
    {}

// ADDED for Oak (by exeng) - similar to above but without args to connectWiFi()
  void connectWiFi()
    {
        BLYNK_LOG("Oak in connect WiFi");
        WiFi.begin(); // Oak is already has a configured SSID to connect to
       
        while (WiFi.status() != WL_CONNECTED) {
            ::delay(10000);  // delay 10 seconds
        }
        BLYNK_LOG("Connected to WiFi");

        IPAddress myip = WiFi.localIP();
        BLYNK_LOG("My IP: %d.%d.%d.%d", myip[0], myip[1], myip[2], myip[3]);
    }
// END of ADDED for Oak (by exeng)

    void connectWiFi(const char* ssid, const char* pass)
    {
        /*BLYNK_LOG("Connecting to %s", ssid);
        if (pass && strlen(pass)) {
        	WiFi.begin(ssid, pass);
        } else {
        	WiFi.begin(ssid);
        }*/
        while (WiFi.status() != WL_CONNECTED) {
            ::delay(500);
        }
        BLYNK_LOG("Connected to WiFi");

        IPAddress myip = WiFi.localIP();
        BLYNK_LOG("My IP: %d.%d.%d.%d", myip[0], myip[1], myip[2], myip[3]);
    }

    void config(const char* auth,
                const char* domain = BLYNK_DEFAULT_DOMAIN,
                uint16_t    port   = BLYNK_DEFAULT_PORT)
    {
        Base::begin(auth);
        this->conn.begin(domain, port);
    }

    void config(const char* auth,
            	IPAddress   ip,
                uint16_t    port = BLYNK_DEFAULT_PORT)
    {
        Base::begin(auth);
        this->conn.begin(ip, port);
    }
    void begin(const char* auth,
               const char* domain = BLYNK_DEFAULT_DOMAIN,
               uint16_t    port   = BLYNK_DEFAULT_PORT)
    {
        connectWiFi();
        config(auth, domain, port);
    }

    void begin(const char* auth,
               IPAddress   ip,
               uint16_t    port   = BLYNK_DEFAULT_PORT)
    {
        connectWiFi();
        config(auth, ip, port);
    }
    void begin(const char* auth,
               const char* ssid,
               const char* pass,
               const char* domain = BLYNK_DEFAULT_DOMAIN,
               uint16_t    port   = BLYNK_DEFAULT_PORT)
    {
        connectWiFi();
        config(auth, domain, port);
    }

    void begin(const char* auth,
               const char* ssid,
               const char* pass,
               IPAddress   ip,
               uint16_t    port   = BLYNK_DEFAULT_PORT)
    {
        connectWiFi();
        config(auth, ip, port);
    }

};

static WiFiClient _blynkWifiClient;
static BlynkArduinoClient _blynkTransport(_blynkWifiClient);
BlynkWifi Blynk(_blynkTransport);

#include <BlynkWidgets.h>

#endif

Any help dear @vshymanskyy ???

Please try to help me by answering my questions.

Thanks

Hey. BLYNK_DEBUG is right there in the documentation: http://docs.blynk.cc/#troubleshooting-enable-debug

Oh, I didn’t know that. I will read and try to see what is wrong. Thanks a lot.

@mikekgr, is the issue solved?

Yes, it is working… The BIG issue I thought that I have was the no updating of RTC widget…
Now that all are clear the blynk RTC in working fine to me. Just remove the picture that shows RTC with time etc at the bottom of the widget.

Thanks!