I decided to do the binary clock as my second assignment as, after my simplistic effort on the motor, I figured I should try and challenge myself a bit more. Not gonna lie, Binary perplexes me, so I’ve had to read and borrow a lot whilst trying to get my head around this. The code came from lots of different places and I patched it together.
I went for a 24 hour time system as it seemed to be slightly easier than just 12 hours.
If it was 7am, the time would be 0700 hours and if it were 7pm, the time would show as 1900. Looking at the my doodle above, in the first column of the hour LEDs, if the first led was lit up, its value would be worth 1 and in the second column if the 4th(top) LED was lit, its value would be worth 8. Therefore you would have 18. For the minute columns, it has the third LED and the first LED lit up. This value would be 4 and 1, so 5. The second column, third led is lit up would give a value of 4. So together you would have 54. So, the overall time would read as 18:54 which would be 6:54pm. Confused? Me too. But let’s continue.
My poor little Arduino also cannot tell the time, so I put in 2 buttons to set the time, one for hours and one for minutes. I felt a little bit like this was cheating, but you have to set the time on any clock really – so I’ll let myself off. Other than that, it works perfectly. I did video it, but it’s not very exciting, so I’ll leave you with a photo instead.