Measuring Wind Speed and Wind Direction

header-lesson-06

Measuring Wind Speed and Wind Direction#

Click on the “OLED” drawer in the Toolbox.

makecode-weatherbit-ws-wd-01

Select the initialize OLED block.

makecode-weatherbit-ws-wd-02

Place the initialize OLED block in the on start block. This only needs to run once. Do not change the dimensions.

makecode-weatherbit-ws-wd-03

Click on the “Weatherbit” drawer in the Toolbox.

makecode-weatherbit-ws-wd-04

Select the start wind monitoring block.

makecode-weatherbit-ws-wd-05

Place the start wind monitoring block in the on start block. This code only needs to run once.

makecode-weatherbit-ws-wd-06

The forever block can be moved.

makecode-weatherbit-ws-wd-07

It is now unobstructed.

makecode-weatherbit-ws-wd-08

Click on the “OLED” drawer of the Toolbox.

makecode-weatherbit-ws-wd-09

Click on the “OLED” drawer of the Toolbox.

makecode-weatherbit-ws-wd-10

Place the show string block in the forever block.

makecode-weatherbit-ws-wd-11

We now need to format the strings as in the previous lesson. Click on the “Advanced” drawer of the Toolbox.

makecode-weatherbit-ws-wd-12

Click on the “Text” drawer.

makecode-weatherbit-ws-wd-13

Select the join block.

makecode-weatherbit-ws-wd-14

Place the join block in the show string block.

makecode-weatherbit-ws-wd-15

Select the text in the join block.

makecode-weatherbit-ws-wd-16

Delete the text “Hello” in the first oval, and delete “World” in the second oval.

makecode-weatherbit-ws-wd-17

Duplicate the show string block.

makecode-weatherbit-ws-wd-18

Select the duplicated show string block.

makecode-weatherbit-ws-wd-19

Place the block in the forever block below the other block as displayed below:

makecode-weatherbit-ws-wd-20

makecode-weatherbit-ws-wd-21

makecode-weatherbit-ws-wd-22

makecode-weatherbit-ws-wd-23

makecode-weatherbit-ws-wd-24

makecode-weatherbit-ws-wd-25

makecode-weatherbit-ws-wd-26

makecode-weatherbit-ws-wd-27

makecode-weatherbit-ws-wd-28

makecode-weatherbit-ws-wd-29

makecode-weatherbit-ws-wd-30

Click on the “Weatherbit” drawer of the Toolbox.

makecode-weatherbit-ws-wd-31

Select the wind speed block.

makecode-weatherbit-ws-wd-32

Place the wind speed block in the truncate block.

makecode-weatherbit-ws-wd-33

Click on the “Weatherbit” drawer of the Toolbox.

makecode-weatherbit-ws-wd-34

Select the wind direction block.

makecode-weatherbit-ws-wd-35

Place the wind direction block in the join block.

makecode-weatherbit-ws-wd-36

As in the previous sections. You need to stop the OLED from repeating the data. Click on the “Basic” drawer of the Toolbox.

makecode-weatherbit-ws-wd-37

Select the pause block.

makecode-weatherbit-ws-wd-38

Place the pause block below the show string blocks in the forever block.

makecode-weatherbit-ws-wd-39

Change the pause to 5 seconds in the dropdown menu.

makecode-weatherbit-ws-wd-42

Click on the “OLED” drawer of the Toolbox.

makecode-weatherbit-ws-wd-43

Select the clear OLED display block.

makecode-weatherbit-ws-wd-44

Place the clear OLED display below the pause block in the forever block.

makecode-weatherbit-ws-wd-45