This is Makecode Grove - Oled Display(SH1107) package for micro:bit.
Simply connect Grove - Oled Display(SH1107) to the I2C port of Grove shiled, as the picture shown.
Let's start with a very simple program:
-
In this program, the second line
set oled to Create Oled Display
means we will create an object to use Oled Display, this step is important and nessary. -
Line
oled Clear display
means the display will be clear. This step is recommanded at the begin of a program. -
Line
oled Set display position at row 0 and column 0
is very useful. We can use this beforeDisplay string
orDispaly integer number
, to set our display position. Note that there are 16 row and 128 column in Grove Oled Display, androw 0, column 0
is at the upper left corner. -
Line
oled Display string "Hello!"
is to display a string "Hello!"
Try to download the program to your Microbit! Then you will find "Hello!" on the display. Now let's try a big program like this, and guess what will happen:
Let's draw 2 lines first:
oled Draw horizontal line start at x 0 and y 0, length 128
means draw a horizontal line. Please check the second picture of Demo 1, it also indicates the XY axis.
And draw a rectange by giving 2 XY coordinates.
MIT