Difference between revisions of "MWatch"
From Microduino Wiki
(→Principle) |
(→Principle) |
(One intermediate revision by the same user not shown) | |
(No difference)
|
Latest revision as of 03:51, 28 January 2016
Language: | English • 中文 |
---|
ContentsObjectiveUse mCookie to build a simple watch. PrincipleAcquire time via RTC module and display time on the OLED screen. Equipment
Preparation
Program Description
void setRtcTime (byte _year, byte _month, byte _day, byte _week, byte _hour, byte _minute, byte _sec)
{
//clear out all the registers
rtc.initClock();
rtc.setDate(_day, _week, _month, 0, _year);
rtc.setTime(_hour, _minute, _sec);
} Code DebuggingFind this code section and set the initial time of the RTC module. Re-load the code to CoreUSB after setting. setRtcTime(15, 5, 18, 1, 00, 00, 00); Enter "//" before this code section after loading the program, the whole section will turn gray and then re-load the program and you'll see RTC can time automatically. ("//" means "comment out the program code and do not perform ". In this way, you needn't run the program after calibration or the system will need re-set time after power-fail and re-start. ) //setRtcTime(15, 5, 18, 1, 00, 00, 00); Hardware Buildup
ResultThe first line shows data and week. The second line displays: time and the third displays custom text. Video |