This is the MakeCode Package for SSD1306 OLED controller, based on the Adafruit Arduino library available here.
- Insert the OLED display into the I2C ports on the break out board.
Initializes the OLED display.
Sets up the OLED display and prepares it for use by the micro:bit.
OLED.init(64, 128);
This block must be placed before any of the show
blocks.
Displays a string on the OLED module without a newline.
OLED.showString1("hello, micro:bit!")
The init
block must be placed before this.
Displays a string on the OLED module with a newline.
OLED.showString2("hello, micro:bit!")
The init
block must be placed before this.
Displays a number on the OLED module without a newline.
OLED.showNumber1(123)
The init
block must be placed before this.
Displays a number on the OLED module with a newline.
OLED.showNumber2(123)
The init
block must be placed before this.
Clears the display.
OLED.clear()
The init
block must be placed before this.
Displays a pre-made loading screen.
OLED.Loading_Screen()
The init
block must be placed before this.
Displays an outline of a rectangle.
OLED.drawRectangle(x,y,w,h)
The init
block must be placed before this.
Displays a filled rectangle.
OLED.fillRectangle(x,y,w,h)
The init
block must be placed before this.
Displays an outline of a circle.
OLED.drawCircle(x,y,r)
The init
block must be placed before this.
Displays a filled circle.
OLED.fillCircle(x,y,r)
The init
block must be placed before this.
Displays a line.
OLED.drawLine(x1,y1,x2,y2)
The init
block must be placed before this.
Displays a progress bar with a specified percentage of progress.
OLED.showProgress()
The init
block must be placed before this.
The following code is a simple counter that displays an increasing number every second.
OLED.init(64, 128)
let item = 0
basic.forever(() => {
basic.pause(1000)
item += 1
OLED.showNumber(item)
})
- for PXT/microbit (The metadata above is needed for package search.)
NFC=github:ouki-wang/pxt-nautual-science