Coder Social home page Coder Social logo

ssd1306_microbit's Introduction

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 Without Newline

Displays a string on the OLED module without a newline.

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

The init block must be placed before this.

Show String With Newline

Displays a string on the OLED module with a newline.

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

The init block must be placed before this.

Show Number Without newline

Displays a number on the OLED module without a newline.

OLED.showNumber1(123)

The init block must be placed before this.

Show Number With Newline

Displays a number on the OLED module with a newline.

OLED.showNumber2(123)

The init block must be placed before this.

Clear Display

Clears the display.

OLED.clear()

The init block must be placed before this.

Draw Outlined Rectangle

Displays an outline of a rectangle.

OLED.drawRectangle(x,y,w,h)

The init block must be placed before this.

Draw Outlined Circle

Displays an outline of a circle.

OLED.drawCircle(x,y,r)

The init block must be placed before this.

Draw Line

Displays a line.

OLED.drawLine(x1,y1,x2,y2)

The init block must be placed before this.

Progress bar

Displays a progress bar with a specified percentage of progress.

OLED.drawLoadingBar(percent)

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

ssd1306_microbit's People

Contributors

atrus159 avatar elecfreaks1 avatar firemansamm avatar jensenhuangyankai avatar jwunderl avatar marcusbcn avatar nioq avatar ranaldmiao avatar shaunleong avatar xmeow avatar yjsoon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.