How to use DS1307 RTC with Arduino + LCD/OLED 12h/24h formats

Поділитися
Вставка
  • Опубліковано 16 лис 2024

КОМЕНТАРІ • 13

  • @leeralph7765
    @leeralph7765 5 років тому +2

    Evening Yassine.
    Thank you for this great tutorial, out of all I have seen this is the best.
    One problem though, have set this up and followed your tutorial to the letter (down loading everything from your site), I have run the simple program and the rtc worked really well, have run clock file 1 and 2 for oled and it looks great (better than I have attempted so far lol). But can not get the clock files to talk the rtc? (shows 12:00am 1/1/2001). Any idea where I may be going wrong?. Using the same display and Same tiny rtc as seen in your video.
    Thank you for your time and thanks again for the tutorial.

    • @SurtrTech
      @SurtrTech  5 років тому

      Thanks a lot, did you try first to set the RTC using the first example?
      Upload the "SetTime" example first while the RTC is wired.
      Then try the other codes.

    • @leeralph7765
      @leeralph7765 5 років тому

      @@SurtrTech ah, there we go, all working. Thank you very much for your help and keep up the good work.

    • @leeralph7765
      @leeralph7765 5 років тому

      @@SurtrTech and also a bit of fault finding found a dodgy battery fitted to the back of the rct 😣

    • @SurtrTech
      @SurtrTech  5 років тому

      @@leeralph7765 Thank you very much, I'm happy it's working, normally those batteries last around 10 years, but if you could change it it would be better

  • @sergiomoranavarrete9426
    @sergiomoranavarrete9426 5 років тому

    Hello, Thanks for the video, but I still can not print2digits on a ssh1106 u8glib. Is there any way to see it on an OLED?

    • @SurtrTech
      @SurtrTech  5 років тому

      Did you modify the function below? Because that function is not in the library, I just made it, make sure to adapt it to your display library too

  • @rickyamri7643
    @rickyamri7643 4 роки тому

    hello, how to set the time?

  • @ManuPithiviers
    @ManuPithiviers 4 роки тому +1

    Thank you !

  • @thomaswilkerson9961
    @thomaswilkerson9961 4 роки тому

    Print2digits wors great thnak you
    I Can not get 12hr time, else if(Hour>12){
    Hour=Hour-12; //substract 12 to bring it back to 1,2,3,...
    a=false;
    display.print(Hour);
    Please help tia

    • @SurtrTech
      @SurtrTech  4 роки тому

      I don't understand your problem.
      The code detect which hour and if it's 0- under12 it shows normally and with a "am", if it's 12 it shows 12 with "pm", higher than 12 it goes back to 12h format with "pm" symbol. if it's 0 (midnight) it shows 12 "am".

    • @thomaswilkerson9961
      @thomaswilkerson9961 4 роки тому +1

      @@SurtrTech
      Thanks for your response. Sorry but I confused my own questions with another video. Here I'm trying to get your OLED_3 sketch to put a zero in when hours, minutes, or seconds are less than 10 so there are 2 digits displayed. I tried using print2digits(tm.Second); along with
      void print2digits(int number) {
      if (number >= 0 && number < 10) {
      display.write('0');
      display.display();
      }
      display.print(number);
      display.display();
      display.println();
      }
      I give 2 digits but everything on the display after that command flickers i.e the PM,month, day, and year flash rapidly. any help is appreciated,

    • @SurtrTech
      @SurtrTech  4 роки тому

      Well you'll have to create another function for example" print2digits(int and here it should read the hour/minute/sec).
      Inside the function you'll test if the variable is