5% OFF Over \$19, Code: Elephant5; 10% OFF Over \$59, Code: Elephant10

Micro:bit Smart Robot 1.8 Lesson 8 “Good morning, good night”

Posted by SunFiona on

1.Learning goals

Sunlight(Good morning)           Moon (Good evening)

After downloading the program,When the micro:bit development board is in the brighter environment, a pattern of the sun will be displayed on the dot matrix, which means to say "good morning" to everyone. similarly, when in a dark environment,  the moon pattern will be displayed on the dot matrix, which means to say "good night" to everyone.

2.Preparation

Hardware:

●  Micro: bit Board X 1

●  Micro USB Cable X 1

●  AAA batteries X 2

Then the micro:bit is connected to the computer through USB, and the computer will pop up a U disk and click the URL in the U disk to enter the programming interface.

3.Search for blocks

4.Combine blocks

20 here is an intermediate value set freely,The meaning of building blocks is that:If the current light intensity is less than 20, the moon will appear on the dot matrix. If greater than 20, the

sun will appear.

Median value: Put all the numbers in numerical order. If there is an odd number of results, the median is the middle number. If there is an even number of results, the median will be the mean of the two central numbers.(in this course, you can set the middle value on your own).

The code of the experiment:  Lesson 8 Good morning, good night.rar