Quantcast
Viewing all articles
Browse latest Browse all 20046

Re: Using real-time clock that has Intel Galileo

Hi DiegoV_Intel

Thanksfor your input

"Real Time Clock

Most Linux boards rely on a connection to the Internet to get the current date and time. But with Galileo’s on-board RTC (real time clock), you’ll be able to track time even when the board is powered off. Just wire up a 3.0V coin cell battery to the board."

seethis code.

char buf[9];

void setup()

{

  Serial.begin(115200);

  system("date 010112002013"); //sets the date & time to 12:00 1st Jan 2013

}

void loop()

{

system("date '+%H:%M:%S' > /home/root/time.txt");  //get current time in the format- hours:minutes:secs //and save in text file time.txt located in /home/root

  FILE *fp;

  fp = fopen("/home/root/time.txt", "r");

  fgets(buf, 9, fp);

  fclose(fp);

  Serial.print("The current time is ");

  Serial.println(buf);

  delay(1000);

}

working fine, but the only thing the I don´t like, the part on the "system("date 010112002013"); //sets the date & time to 12:00 1st Jan 2013" every time when restart the Intel Galileo, always I see the date & time begining at 12:00

orhow to accessthereal time clockthat runs onbatteryjust putthe pinsindicated

Regards,



Viewing all articles
Browse latest Browse all 20046

Trending Articles