Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 18548

Accessing RTC via arduino code

$
0
0

Hello,

 

I want to gain more understanding on accessing the Galileo's RTC. Currently all I have seen is the system command being used to access the Linux OS and set and retrieve the time. This uses the following commands in Arduino:

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);

 

}

 

 

I am unfamiliar with Linux and asuch do not really understand what is happening here. I need to establish a timer between two points in time. What resources are suggested for me to understand what is going on and how to make the RTC accessible to me?

 

Thanks!


Viewing all articles
Browse latest Browse all 18548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>