The Hardware requirements for this project consist only of an M5Paper from M5Stack which you can buy from this link: M5Paper
And a 3D printed stand from this link: M5Paper Stand by Shotokutech
The Code.When run the above code will show the following on the M5Papers screen.
Please note that while the date shows November and not December, the countdown is only set to react to the day of the month, not the complete date.
How the Code Works.There are several sections to the code which do different things. The First Section of the code is used to query an NTP Time Clock.
As you can see, this is set by default to query the NTP Timeclock in china by default as this is where the UIFLow Server is hosted. In order to change the host, click on the arrow on the right and a dropdown list of hosts appear.
Currently there is no UK host in the list and so I'm using the Chinese (cn.pool.ntp.org) host and then using the timezone block on the end to manually adjust the time zone difference. The value changes the time in hours.
The Next set of blocks are used to set font and text values that don't need to be changed after the program has started.
Next we have the program Loop that checks the date and formats the date:
The next block query the day, makes a quick calculation and tells us how many days till Christmas.
Next will have a little logic that works out if it's Christmas Day and pops up a message if it is Christmas Day.
Then we have the final blocks that cause the program to wait before updating the screen.
These Last two are important because the M5Paper using an E-Ink display and refreshing the display can cause a form of "burn in" where the last image is retained on the screen.
While this is only for the M5Paper, almost identical code can be used and run on the smaller M5Ink.
Comments