Display the time, date, temperature and inspirational quotes on your E-Ink display.
We're going to turn our e-ink display into a clock that shows the time, date, temperature and some inspirational quotes!
Create a new Microbit project.
Go to the Makecode.com Microbit website using the link below and click on the 'New Project' button underneath the 'My Projects' heading.
Install the micro:bit app on your iPad or tablet.
Open the app, tap 'Create code' and then create a new project.
To access the blocks we need to program the e-ink display, you need to add the inkybit extension to your project.
To add an extension follow these steps:
To access the blocks we need to use the date and time, you need to add the microbit-pxt-timeanddate extension to your project. Just search for "time" when adding an extension and you will see it.
To add an extension follow these steps:
We need to set the current date and time so that our clock starts off correct.
Add the following code to your project (and set the correct date and time).
We will be updating the time that is displayed every minute so we will need a function that displays the current time. We can then call this function to run every 60 seconds so that the correct time is displayed.
Create a function called refreshTime and the following code to it.
Functions are useful if you have some code/instructions that you want to use again and again.
To create a function go to the Advanced > Functions toolbox and click 'Make a Function'.
Give your function a name that makes sense and choose whether to pass anything into the function. In this example we will pass in a number.