INTRODUCTION

场景图

Signboards make our lives more convenient. They make it easier for us to identify directions, learn more about public facilities and the environment around us.

In life, we can use the display and other sensors to do a variety of experiments. In the following, we will use OSOYOO 1602 I2C module as the display, connect it to I2C pin headers of the Expansion Board for micro:bit. You will learn how to control the 1602 LCD show some characters like “This is OSOYOO” or some numbers.

PARTS NEEDED

You will need the following parts:

Hardware Hookup

Ready to start hooking everything up? Check out the wiring diagram and hookup table below to see how everything is connected.

接线表格

Insert the micro:bit into keyestudio micro:bit sensor V2 shield. Then connect the 1602 LCD to IIC pin headers on the shield. Connect the SCL pin to P19, SDA pin to P20, VCC pin to VCC(Now you need to put the power switch jump cap to 5V ), GND to ground. Shown below.

接线实物图

Note:micro:bit will always stay attached to the expansion board in the following sessions.

PROGRAM

If you are not familiar to make code, don’t worry. Firstly, you can enter this link:https://makecode.microbit.org/reference to know more about microbit blocks.
Then you can directly enter the https://makecode.microbit.org/ to edit your project program. Below is an example code we have done for you.

usage

open your microbit makecode project, in Add Package, paste

https://github.com/microbit-makecode-packages/i2cLCD1602

to search box then search.

I2C Address

PCF8574 PCF8574A
0x27 0x3F

API

Either copy and paste, or re-create the following code into your own MakeCode editor by clicking the open icon in the upper right-hand corner of the editor window. You can also just download this example by clicking the download button in the lower right-hand corner of the code window.

Overhere, the I2C address of this device is “0x27”, so we type “39” in the address bar.

If your device  I2C address is “0x3F”, please enter “63” to the address bar.

RESULT

After downloaded this code to your micro bit, pull out the USB line and insert the USB line to the expansion board, you will see “This is OSOYOO” on the LCD screen, then the entire screen will be full of random numbers.

Note:

If the screen is not bright, please check the wires. If the screen is bright, but you do not see the above results, please check you I2C address and the working voltage.