How do i get hours and minutes from my PC in an integer variable.

Hello I am from Serbia.Recently I started using Arduino and i wanted to make an project .My idea was to create a digital clock and print digits on LCD.I know how to print numbers on LCD but i don't know how to get time from PC.So if you have i time please answer.

Thanks in advance Branislav.


Your Arduino can not read the time from the PC. So you will need an application on your PC that reads the time and sends that via e.g. Serial to the Arduino.

Most people use buttons to set the time on an Arduino clock. No PC needed!

sterretje: Your Arduino can not read the time from the PC. So you will need an application on your PC that reads the time and sends that via e.g. Serial to the Arduino.

Which application do i need?

sterretje means to say that you will need to create an application on your PC to do this. sterretje does not expect you to do this, because there are easier ways...

Acting alone, Arduino does not make a good clock. It's crystal is not accurate enough, and when power is lost it will forget the time and must be adjusted again.

The are a few options to make a good clock with Arduino. These include GPS and NTP. But the easiest for a beginner is to get an RTC module. These have accurate crystals and a backup battery.

PaulRB: sterretje means to say that you will need to create an application on your PC to do this. sterretje does not expect you to do this, because there are easier ways...

Acting alone, Arduino does not make a good clock. It's crystal is not accurate enough, and when power is lost it will forget the time and must be adjusted again.

The are a few options to make a good clock with Arduino. These include GPS and NTP. But the easiest for a beginner is to get an RTC module. These have accurate crystals and a backup battery.

So can you send me an example which i can use to load my RTC with current time.

Branislav1604: So can you send me an example which i can use to load my RTC with current time.

You have an RTC? Why did you not think this important to tell us?

Post your code. Read the forum sticky post to find out how to do this correctly.