Trying to retrieve time from ds3231 to display on the LCD

I am using the christmas P2 bundle and I am follwing jonnymacs beginners guides.
I am able to get text to appear on the lcd but Iam trying to get the time from ds3231 to show on the Lcd.
I tied t the way i used inP1 but no luck.

I need help .

Thank you



  • JonnyMacJonnyMac Posts: 7,323
    The LCD object has numeric formatting methods. You can read the time from the clock as three bytes and then use the fhex() method for output. Remember, the registers from the clock are BCD, so we use hex methods with them.
  • msiriwardenamsiriwardena Posts: 221
    edited 2021-01-14 12:36
    @ jonnymac

    Thank you, I knew you are going to help me.
    You did help me when i was building the infant ventilator using P1 and I tested on a baby pig
    and i t worked as it was intended.
    Thank you again for your time.

  • JonnyMacJonnyMac Posts: 7,323
    Did you get it working? Sorry, I didn't have a lot of time earlier because I was preparing for my class. I've attached some code that combines elements from last week with elements from this week. It displays the time of line 0 and the temperature on line 1.
  • @JonnyMac
    I did not get it to work, but I knew from P1 I had to read a byte at a time and I was working on it.
    Thanks for your code , that was exactly what I was trying to do. Now I am studying your to see
    why and where I got it wrong.
    This keeps my mind occupied most of the day and learning some thing new.

    Thanks again for the help - " keeping my neurons alert/active and busy"

  • JonnyMacJonnyMac Posts: 7,323
    Well, actually, you can read the time registers (seconds, minutes, hours) with one call. That's what I'm doing in this demo. If the seconds changes, it refreshes the time. The temperature doesn't update as frequently, so it is only requested on a new 10-second mark. This is detected by looking for the 1s digit of the seconds register to be zero.
Sign In or Register to comment.