How can I automatically get the time from the computer into an alarm clock (starts at 00:00 when plugged in)? Okay so I did this project from Fritzing first in my circuits.io project then on the arduino itself, it all works fine just how I wanted it.

But here is what I wanted to add, as you can see when you plug the arduino in it will set the time to 00:00 and you can adjust it yourself to the time right now, let's say 12:57. Then you put in the alarm so let's say you want to sleep an hour u put the alarm on 13:57.

Is there a way to automatically get the time from the computer? So you don't have to adjust it yourself everytime and start from 00:00.

Thanks for all the help!
There are several ways, and they are covered in the comments above.


The answer to your question. Via Arduino USB to serial interface. and a simple batch file on a windows computer example:

@echo off

set datetimef=%time:~0,2%.%time:~3,2%:%time:~6,2%

echo %datetimef% > COM5


COM5 is used as a example, your serial port can be another number.

The format in the example is hour.minute:second