A clock that has the time ready for me when I’m most likely to be checking the time, because I am tired of the tapping gesture to see the time on my phone.

The clock display is dark and will light up and show the time when I request it by pressing a button and will also light up and show the time at the times I’ve checked the time in the past. Every button press logs the current time, and if the minutes and hours match the time on a subsequent day, the display will show that time.

IMG_3419.mov

Code at the bottom of the page.

Hardware:

Arduino Zero

Adafruit Datalogger Shield

Adafruit 7-Segment LCD Display

Push-button

Process:

Current issues:

RTC.now.minute() is off by 30 seconds:

Untitled

I got getting reading and writing to the the SD card on a push of a button working. Once that was working, I connected the display.

Right now the program is constantly reading from the logged file to compare the times in the log with the current time in order to display matches. This is a lot of reading, but I haven’t been able to come up with better methods. The trouble is that the data isn’t sorted, so if I only want to be checking the next time I need to show, I don’t know how to find that next time. I researched how to add data into a file in sorted order, so each new timestamp is inserted in the right place, and this involves low level programming that I don’t know. The other possibility is reading into an array and then sorting. The alternate method I tried is:

when button is clicked, read all file contents into array including the just added time, then sort the array, then retrieve the index of the element that was just added, then use that to get the element of the NextTimeShown, and then in the loop only compare the NextTimeShown variable to the current time

→I didn’t get this working, I was able to read it into an array but I couldn’t get the index of the NextTimeShown

I faced a lot of difficulties with my Arduino. Almost every time when I’m working on the project there’s a period of time where the Arduino won’t show up in the listed ports, even when I manually search for the correct port. I then plug and unplug the cable, restart the IDE, restart the computer, and after repeating these steps countless times it will start working again.

Untitled