How do I send my computer clock data to my arduino?

I want to make a clock program to show on a graphic lcd, but I need to know how to get the right time for the clock.

Without an RTC, GPS or some other way of getting the time, you'll have to send in the current time at compilation and then update your time using the millis() call.

An easy way to send in your time at compilation is to break down the string that TIME defines, to give you the hour, min, second etc.

Look at the examples for basically any of the RTC libraries. You will see that they use the compiler's predefined TIME to hardcode the time into the program, which then looks at the RTC and sets that time only once. You lose a few seconds between the program being compiled and uploaded but that usually isn't important.

Hi,

Here is what I do.

  1. download Gobetwino
  2. in settings set your com port and baud rate
  3. use the fixed command T to send your PC time
Serial.println("#S|T|[]#");

to the com port
4. in your arduino programme you capture the time with Serial.read()
5. output to your display

http://electronics.divinechildhighschool.org/Home/Arduino-Lessons/using-gobetwino-to-control-windows-through-arduino

I want to make a clock program to show on a graphic lcd, but I need to know how to get the right time for the clock.

Since my graphic lcd is broken, I have only done it on my 16x2 lcd display.

I got the time to the screen but it only recieves one number each reading and if I use parseInt it show wierd symbols.

I have a Sparkfun 128x64 Graphic LCD And a Sparkfun 16x2 LCD both are Serial. I can use either but I would rather use the Graphic LCD

The problem is on line 42 of the code that you didn't show us.

I didn't show any code

That's what he wrote.

IIRC an Arduino UNO clock may be off by 3 minutes or so a day but it's always the same as long as temperature and supply voltage don't vary much so it can be corrected for in software. Upshot is you should only have to update the date and time once in a while for reasonable needs.

So you have the PC send a serial message Y##M##D##H##M##S## with leading zeros so 3 is 03.
And you use a modified version of Nick Gammon's Non-Blocking Serial Text State Machine (sounds like a lot more code than it is, SM's tend to be small for the job) which is a section on the 2nd Nick Gammon blog page addressed in my sig space below. His does RPM, Gear and Speed instead of date/time.

IIRC, DOS console MODE command can set up serial comms, I did it to Arduino years ago to test. You can redirect the standard input and output of different programs to COMx to get your data out but you might have to roll your own to get just the format you want. It's easier with Linux, IIRC.

There's another way called the Unix Second, how many seconds have passed since the start of 1970 which can get turned into date and time for display through available standard code. Where it shines is timestamps. You can subtract one time from another and get seconds between quickly and years, etc, a tiny bit less quickly but faster than you can notice.
With that you send a start marker, 8 hex characters, an end marker, and have the Arduino convert that to Unix seconds for display only.

I didn't show any code

Because you did not want any help. So, you are not getting any. What is the problem?