Real Time Clock

The real-time clock is one of the main functions of Xtron Pro. Xtron Pro is composed of the core and the gamepad, the core can work as a watch with a silicone case. With the real-time clock function, you can write basic clock applications.

The real-time clock is a low power clock/date device with a programmable time-of-day alarm and a programmable interupt output. To use of the RTC function, first you should load pxt-xtronpro-rtc extension to MakeCode Arcade, which will add a RTC catogory in the toolbox.

Example

The following example will display the time, date and alarm on the screen.

Click the below link you will go to MakeCode Arcade simulator, which will show the example, then click the Edit Code button to open the Editor to modify or download the example.

RTC Example

Tutorial

Click the below tutorial link to make your own watch application.

Tutorial

API

time

Returns the selected item of the time in decimal number.

Learn More

stringFormatTime

Get time in string format.

Learn More

setTime

Set the time of the RTC.

Learn More

setAlarm

Set the alarm time of the RTC.

Learn More

onEvent

Run some code when the alarm time is up.

Learn More

clearAlarmStatus

Clear alarm interrupt status, it is alway used in alarm onEvent function, if you forget to use it, the alarm can only fire once even though in repeat mode.

Learn More

alarm

Returns the selected item of the alarm time in decimal number.

Learn More

stringFormatAlarm

Get alarm time in string format.

Learn More

alarmRepeatMode

Get the alarm repeat mode of the RTC.

Learn More

isAlarmOn

Get the alarm On/Off status.

Learn More