EasyManua.ls Logo

AZ-Delivery DS3231 - Page 31

AZ-Delivery DS3231
32 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The function read_datetime() has two arguments and returns a tuple.
The first argument represents the century, an integer value, for example: for
21st century, use century=21. The second argument represents time
zone info, used for datetime objects (it is not covered in this eBook). The
return value is a tuple which has seven elements. The elements are:
dayOfWeek, dayOfMonth, month, year, hour, minute and second (in this
order). All values for these elements are integer numbers, except the value
of dayOfWeek argument which is a string value, which represents the name
of the weekday.
The function read_str() has one argument and returns a string value.
The argument is the century argument, and is used as the century
argument of the read_datetime() function. The return value is a string
value, with predefined format for date and time data, as shown in the
following script output:
System time: 2020-03-15 15:44:15
RTC date: Sunday 15.03.2020
RTC time: 15:44:15
RTC date_time: Sunday 15-03-2020 15:44:15
Temperature: 28.8°C
To get temperature data from the RTC module, use the function called
detTemp(). The function has no arguments and returns a float value. The
return value, a float value, represents the temperature data in Celsius.
- 29 -