Set date and time:
We use this block to set the current date and time. In this case, we start
the time from the beginning of the program, so the time needs to be set exactly the same
as your local time, or you can set it faster because you need time to upload the program,
otherwise the clock may be inaccurate.
And:
It is a logic
and
block. This combines two logical statements into one statement that
returns true when both of the other statements are true and only true. In this experiment,
when hour equal to 7 and minute less than 2, then if run the code inside if statement.
Otherwise, the code inside if statement will not run.
Download the program to micro:bit to see what happens.
It takes too much time to scroll the messages on the micro: bit's matrix LEDs, which makes
viewing very inconvenient. But don't worry, you will learn a better way to display messages or
data from this experiment. It does not require you to spend time waiting for the information to
scroll. You can see all the messages and data at a glance. This method is to use OLED for display.
Experiment 15 – Distance display
Instruction
After uploading the program, the buzzer will start playing music for 2 minutes.
Then, if you don't stop powering the micro: bit, the buzzer will play the
"alarm" for 2 minutes every day starting from 7 am.
Result
Can you display the time on the micro: bit's matrix LEDs in the format we see every day?
35