Changeset 175 for rtos_arduino/trunk/arduino_lib/libraries/RTC/examples/RTC_simple_24H_mode/RTC_simple_24H_mode.ino
- Timestamp:
- Mar 28, 2016, 2:09:46 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rtos_arduino/trunk/arduino_lib/libraries/RTC/examples/RTC_simple_24H_mode/RTC_simple_24H_mode.ino
r136 r175 2 2 This sketch gives a simple demonstration of how to use RTC library. 3 3 The code sets date and time using internal structure and then print on serial date and time. Time representation is 24 hour mode 4 5 NOTE: for M0/M0 pro only you can select the oscillator source for count. 6 If you want to use a low power oscillator use rtc.begin(TIME_H24, LOW_POWER); function. 7 If you want to use a more accurate oscillator use rtc.begin(TIME_H24, HIGH_PRECISION); function. 4 8 **********************************************************************************************************************************************************/ 5 9 … … 34 38 35 39 //printing date in format YYYY/MM/DD 36 Serial.print(rtc. local_date.year+2000); // year40 Serial.print(rtc.date.year+2000); // year 37 41 Serial.print('/'); 38 Serial.print(rtc. local_date.month); // month42 Serial.print(rtc.date.month); // month 39 43 Serial.print('/'); 40 Serial.print(rtc. local_date.day); // day44 Serial.print(rtc.date.day); // day 41 45 Serial.print(' '); 42 46 43 47 //printing time 44 Serial.print(rtc. local_time.hour); //hour48 Serial.print(rtc.time.hour); //hour 45 49 Serial.print(':'); 46 Serial.print(rtc. local_time.minute); //minute50 Serial.print(rtc.time.minute); //minute 47 51 Serial.print(':'); 48 Serial.println(rtc. local_time.second); //second52 Serial.println(rtc.time.second); //second 49 53 50 54 delay(1000);
Note:
See TracChangeset
for help on using the changeset viewer.