Step 0. Using your web browser, go directly to https://makecode.microbit.org to land the MakeCode for micro:bit home page. You can bookmark this package to easily open this package for next project. In the My Projects section, click on the New Project

For more information about MakeCode, please go to our tutorial: What is MakeCode


Step 1. Please read tuturial about LCD1602 to add I2C_LCD1602 Category

Step 2. Drag and drop a LCD initialize with Address 0 block inside the on start block.

Step 3. Drag and drop turn off backlight block from I2C_LCD1602 category over and place it inside the on start block.

Step 4. Click on the Basic category, click and drag the pause(ms) block over and place it inside of the on start block, and choose 500 ms

Step 5. Drag and drop turn on backlight block from I2C_LCD1602 category over and place it inside the on start block.

Step 6. Drag and drop show string hello at x0 y0 block from I2C_LCD1602 category over and place it inside the on start block.

Step 7. Drag and drop show string hello at x0 y0 block again and place it inside the on start block.

Step 8. Change Hello to OSOYOO DHT11  , and choose y1

Step 9. Drag the pause(ms) block over and place it inside of the on start block, and choose 2000 ms

Step 10. Drag and drop clear LCD block from I2C_LCD1602 category over and place it inside the on start block.

Step 11. Drag and drop show string hello at x0 y0 block from I2C_LCD1602 category over and place it inside the forever block, and change hello to Temp:.

Step 12. Drag and drop show number 10 at x0 y0 block from I2C_LCD1602 category over and place it inside the forever block.

Step 13.  Search Extensions with keywords IOT , in search result, select an iot-environment-kit extension as following:

Step 14. Octopus Category can be found in the Toolbox

Step 15. Click Octopus category and then more. Drag and drop value of dht11  at pin  block over and place it inside the placeholder of the show number 10 block

Step 16. Choose temperature(℃) from the drop-down menu if it has not already been selected, and choose at pin P8, and x6

Step 17. Drag the pause(ms) block over and place it inside of the forever block, and choose 2000ms

Step 18. Duplicate these three blocks and change Temp: to Humi:, both y0 to y1, temperature(℃) to Humidity(0-100), and place these three blocks to forever block

Step 19. Drag and drop clear LCD block from I2C_LCD1602 category over and place it inside the forever block.

Step 20. rename the project   and download it

Step 21. Download this “.hex” file and send it to your MICROBIT disk.

Below is the full code we have done for you as reference:

Complete wiring and power with 5V, You will see the LCD show Hello, OSOYOO DHT11, and then it will show Temperature and humidity for every 2s