Easy IoT is a simplest IoT Solution presented by DFRobot
By enmin1997
#22436
Hi I'm using a esp2866 board trying to connect to a DFRobot I2C RTC it works with a Arduino Uno but not when I tried with a esp2866 anyone knows how? Any help appreciated.

The connection I did on the esp2866 was GND=GND, VCC=3.3V, SDA=D2, SCL=D1

This is the code
Code: Select all
 
#include <Wire.h>
 #include <DS1307.h>
 //Modify the following data
 #define TIME_YR    18
 #define TIME_MTH   7
 #define TIME_DATE  30
 #define TIME_DOW   1
 #define TIME_HR    20
 #define TIME_MIN   53
 #define TIME_SEC   30
 char* str[]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};//week 
 int rtc[7];
 void showtime()     //
   {
    RTC.get(rtc,true);
   {    
    Serial.print( rtc[6]);         
    Serial.print("-");   
    Serial.print( rtc[5]);
    Serial.print("-");   
    Serial.println( rtc[4]);
   
    Serial.print( rtc[2]); /*HOUR  MIN SEC */   
    Serial.print(":");
    Serial.print( rtc[1]);
    Serial.print(":");    
    Serial.println( rtc[0]);
    
    Serial.println( str[rtc[3]-1]); /***WEEK**/  
    Serial.println("****");        
    }  
   }
 void setup()
 {  Serial.begin(9600); 
   Wire.begin();
  }

 void loop()
 { 
     showtime();    //Output data from serial port
    delay(1000);
 }
Last edited by enmin1997 on Thu Aug 02, 2018 3:58 am, edited 1 time in total.
By enmin1997
#22512
Hi thanks for the reply but I have changed to a UNO board instead. Now I have a new problem though my UNO board is functioning without a RTC but the code is suppose to only work with an RTC and it worked previously fine with one and stops when I detach the RTC now I'm getting these kind of readings

2165-45-45
45:85:85
Sunday

when I'm just attaching the UNO board and nothing else & even when I'm attaching it to the RTC. (The code is the same as above) What is happening???
By daisywalker407
#22538
I'm constructing an assignment once I want my Arduino to execute some code at given hours of the day, as an instance one at 19:00 and some other at 06:00. I recognize that with an RTC module I'm able to do that without problems, however, how am I able to try this without an RTC module? I do not want to have to join my Arduino to a computer neither to the net. It does now not additionally ought to be particular, a few minutes off would be adequate.
My board is an Uno R3.