Forked from https://github.com/xuefengedu/pxt-oled-ssd1306_CN which bases on https://github.com/Tinkertanker/pxt-oled-ssd1306
- Forked
- Changed name space to oled / oled_ssd1306 and menu entry name to oled:ssd1306
- ! Warning: under development !
- Added more functions:
"oled_ssd1306.setTextCursorToXY|block": " x %x|y %y",
"oled_ssd1306.setTextCursorToRowCol|block": " row %row|column %column"
- Open editor https://makecode.calliope.cc/
- Load additional package https://github.com/BCoDTT/pxt-calliope-SSD1306
- The additional menu entry OLED_SSD1306 is available
None
This is the MakeCode Package for SSD1306 OLED controller, based on the Adafruit Arduino library available here.
- Connect the OLED display with the I2C (A0) port on the calliope mini or in one of the I2C ports on a break out board.
! Attention: The pinout of the (my) OLED board is GND | VCC | SCL | SDA, so to connect it correctly to the calliope mini I2C port (A0) the wires for SCL and SDA have to be crossed.
Initializes the OLED display.
Sets up the OLED display and prepares it for use by the micro:bit.
oled_ssd1306.init(64, 128);
This block must be placed before any of the show
blocks.
Sets the text cursor to the coordinates x/y for printing a string on the OLED module.
oled_ssd1306.setTextCursorToXY(x, y)
Sets the text cursor to the row/column for printing a string on the OLED module.
oled_ssd1306.setTextCursorToRowColumn(row, column)
Displays a string on the OLED module.
oled_ssd1306.showString("hello, micro:bit!")
The init
block must be placed before this.
Displays a number on the OLED module.
oled_ssd1306.showNumber(123)
The init
block must be placed before this.
Clears the display.
oled_ssd1306.clear()
The init
block must be placed before this.
The following code is a simple counter that displays an increasing number every second.
oled_ssd1306.init(64, 128)
let item = 0
basic.forever(() => {
basic.pause(1000)
item += 1
oled_ssd1306.showNumber(item)
})
- for PXT/microbit (The metadata above is needed for package search.)
pxt-calliope-oled-ssd1306=github:BCoMak3r/pxt-calliope-oled-ssd1306