Close

Basic OLED Watch Code Completed

A project log for Trinket Watch

A watch with an OLED display, powered by a Trinket

davishdavish 12/19/2014 at 05:150 Comments

After I tested the OLED in the last entry, I decided to code up a function that would display a time in a relatively pretty way. I started by just finding the part of the Adafruit example code that renders text on the display, and changed it to print out a string, formatted (HH:MM):

I then looked at the example code for the RTC module, and it showed that the values from the RTC are put into a Date object, where you can get the hours and minutes from, as well as Unix time. I wrote code that took variables with seconds and minutes and added one minute to the time every 200 milliseconds. Here's the outcome:

(I apologize for the vertical video).

All of my code is now on GitHub, so feel free to check it out! The link will be in the sidebar.

Discussions