xuefengedu / pxt-oled-ssd1306_CN

SSD1306 OLED液晶micro:bit pxt扩展包

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Forked from https://github.com/Tinkertanker/pxt-oled-ssd1306

SSD1306 OLED液晶micro:bit pxt扩展包

  1. Translate into Chinese Simplified
  2. Add more functions:
    "OLED.drawCircle|block": "画圆 x %x|y %y|r %r",
    "OLED.fillCircle|block": "填充圆 x %x|y %y|r %r",
    "OLED.drawLine|block": "画线 x0 %x0|y0 %y0|x1 %x1|y1 %y1",
    "OLED.drawRect|block": "画矩形 x %x|y %y|w %w|h %h",
    "OLED.fillRect|block": "填充矩形 x %x|y %y|w %w|h %h",
    "OLED.drawRoundRect|block": "画带圆角的矩形 x %x|y %y|w %w|h %h|r %r",
    "OLED.fillRoundRect|block": "填充带圆角的矩形 x %x|y %y|w %w|h %h|r %r",
    "OLED.drawTriangle|block": "画三角形 x0 %x0|y0 %y0|x1 %x1|y1 %y1|x2 %x2|y2 %y2",
    "OLED.fillTriangle|block": "填充三角形 x0 %x0|y0 %y0|x1 %x1|y1 %y1|x2 %x2|y2 %y2"

Usage

1.打开https://makecode.microbit.org/

2.积木块列表中点击“高级”,拉到最下面有个“添加软件包”

3.搜索框中输入https://github.com/xuefengedu/pxt-oled-ssd1306_CN ,点击搜索按钮,点击下面显示的软件包“SSD1306_OLED 用户提供的软件包,非微软维护。SSD1306 OLED液晶micro:bit pxt扩展包”

Screen shots

SSD1306 makecode picture:

Alt text

sample 1 hex download 点击链接后,页面上有3个按钮:“Raw”按钮,“Blame”按钮,“History”按钮,在“Raw”按钮上右键,另存为,进行下载。

sample 2 hex download 比sample 1多加了开始时设置画图显示为关闭,结束时再一次性显示画图的结果。而不是像第一次那样每次画图都显示,第一次每画一笔都发送数据去显示一次,那样效率有点低。

点击上面的链接后,页面上有3个按钮:“Raw”按钮,“Blame”按钮,“History”按钮,在“Raw”按钮上右键,另存为,进行下载。

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

SSD1306 OLED MakeCode Package Build Status

This is the MakeCode Package for SSD1306 OLED controller, based on the Adafruit Arduino library available here.

Hardware Setup

  1. Insert the OLED display into the I2C ports on the break out board.

Blocks

Initialize OLED Display

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.

Show String

Displays a string on the OLED module.

OLED.showString("hello, micro:bit!")

The init block must be placed before this.

Show Number

Displays a number on the OLED module.

OLED.showNumber(123)

The init block must be placed before this.

Clear Display

Clears the display.

OLED.clear()

The init block must be placed before this.

Example: Counter

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)
})

Supported targets

  • for PXT/microbit

Footnotes

  1. Datasheet https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf

About

SSD1306 OLED液晶micro:bit pxt扩展包

License:Other


Languages

Language:C++ 66.8%Language:C 20.2%Language:TypeScript 12.8%Language:Makefile 0.1%