ARDUINO LEONARDO

I an using ARDUINO LEONARDO BOARD, I AM TRYING TO UPDATE TIME TO PC TIME
I AM NOT ABLE TO DO WITH RTC PROGRAM CAN ANY ONE SUGGEST HOW TO SYNC PC TIME TO ARDUINO SYSTEM TIME WITH USB CONNECTION OF LEONARDO BOARD
THANKS - SARAVANAKUMAR - INDONESIA

saravanakumar:
I an using ARDUINO LEONARDO BOARD, I AM TRYING TO UPDATE TIME TO PC TIME
I AM NOT ABLE TO DO WITH RTC PROGRAM CAN ANY ONE SUGGEST HOW TO SYNC PC TIME TO ARDUINO SYSTEM TIME WITH USB CONNECTION OF LEONARDO BOARD
THANKS - SARAVANAKUMAR - INDONESIA

I USE FOLLOWING CODE
I GET TIME SET TO 17:18:19 8 1 2039
/*

  • TimeRTC.pde
  • example code illustrating Time library with Real Time Clock.

*/

#include <Time.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a time_t

void setup() {
Serial.begin(9600);
setSyncProvider(RTC.get); // the function to get the time from the RTC
delay(10000);
if(timeStatus()!= timeSet)
Serial.println(“Unable to sync with the RTC”);
else
Serial.println(“RTC has set the system time”);
digitalWrite(13,timeStatus() == timeSet); // on if synced, off if needs refresh
Serial.println(“in write 13”);
}

void loop()
{
digitalClockDisplay();
delay(10000);
}

void digitalClockDisplay(){
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" “);
Serial.print(day());
Serial.print(” “);
Serial.print(month());
Serial.print(” ");
Serial.print(year());
Serial.println();
}

void printDigits(int digits){
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print(‘0’);
Serial.print(digits);
}

Please don't SHOUT.

Do you have an RTC attached to your Arduino?

THANKS FOR THE BREPLY -I DON' T HAVE RTC BOARD SORRY I AM A NEW USER I AM TRYING TO GET CLOCK TIME SETTING FROM PC THRO USB PORT ( MY ASSUMPTION )

Is there a problem with your CAPS LOCK key? If there isn't, please switch it off and stop SHOUTING.

There is no point trying to use a sketch for an RTC module, when you don't have one. You can use the TimeSerial example, which lets you send the time by sending a string via the serial connection. A Processing sketch is also provided to send the correctly formatted string, but you can also use the serial monitor.

THANKS I WILL TRY THAT