Approved content
The content below is provided by a partner.
makecode I2C OLED 128x64 extension for micro:bit.
Part of the drive base on fizban99’s microbit OLED driver:
https://github.com/fizban99/microbit_ssd1306
Author: shaoziyang
Date: 2018.Mar
open your microbit makecode project, in Extension, paste
https://github.com/makecode-extensions/OLED12864_I2C
to search box then search, and click to add.
let item = 0
OLED12864_I2C.init(60)
OLED12864_I2C.rect(0, 0, 60, 30, 1)
OLED12864_I2C.showString(0, 0, "Hello!", 1)
OLED12864_I2C.showString(0, 1, "1234567890", 0)
item = 0
basic.forever(() => {
OLED12864_I2C.showNumber(0, 3, item, 1)
item += 1
basic.pause(1000)
})
init(addr: number)
initialize OLED module.
addr: OLED I2C address, it maybe 60 or 61, depend on hardware, default is 60.
zoom(d: boolean = true)
set zoom mode. In zoom mode, it will show in double size.
d: mode
on()
turn on OLED.
off()
turn off OLED.
clear()
clear all content in OLED.
draw()
force redraw the content.
invert(d: boolean = true)
show in invert mode.
pixel(x: number, y: number, color: number = 1)
set a pixel in OLED.
showString(x: number, y: number, s: string, color: number = 1)
show a text at specified position.
showNumber(x: number, y: number, num: number, color: number = 1)
show a number at specified position.
hline(x: number, y: number, len: number, color: number = 1)
draw a horizontal line.
vline(x: number, y: number, len: number, color: number = 1)
draw a vertical line.
rect(x1: number, y1: number, x2: number, y2: number, color: number = 1)
draw a rectangle.
MIT
Copyright (c) 2018, microbit/micropython Chinese community
From microbit/micropython Chinese community
OLED12864_I2C=github:makecode-extensions/oled12864_i2c#v1.5.1