Skip to content

MakeCode Library for Adafruit ssd1306 oled version with a reset pin

License

Notifications You must be signed in to change notification settings

Schoumi/ssd1306-with-reset

Repository files navigation

SSD1306 OLED MakeCode Package

Massively Based on https://github.com/tinkertanker/pxt-oled-ssd1306/

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.

ssd1306.init(128, 64,DigitalPin.P2,0x3D);

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.

ssd1306.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.

ssd1306.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.

ssd1306.showNumber1(123)

The init block must be placed before this.

Show Number With Newline

Displays a number on the OLED module with a newline.

ssd1306.showNumber2(123)

The init block must be placed before this.

Clear Display

Clears the display.

ssd1306.clear()

The init block must be placed before this.

Draw Outlined Rectangle

Displays an outline of a rectangle.

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

The init block must be placed before this.

Draw Outlined Circle

Displays an outline of a circle.

ssd1306.drawCircle(x,y,r)

The init block must be placed before this.

Draw Line

Displays a line.

ssd1306.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.

ssd1306.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.

ssd1306.init(64, 128)
let item = 0
basic.forever(() => {
    basic.pause(1000)
    item += 1
    ssd1306.showNumber(item)
})

Supported targets

  • for PXT/microbit

Footnotes

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

Ouvrir cette page à https://schoumi.github.io/ssd1306-with-reset/

Utiliser comme extension

Ce dépôt peut être ajouté en tant qu'extension dans MakeCode.

Éditer ce projet Badge du statut de la compilation

Éditer ce dépôt dans MakeCode.

Aperçu des blocs

Cette section montre le code des blocs du dernier commit dans la branche master. Cette image peut prendre quelques minutes pour être actualisée.

Un rendu de la vue des blocs

Métadonnées (utilisées pour la recherche, le rendu)

  • for PXT/microbit
<script src="https://makecode.com/gh-pages-embed.js"></script><script>makeCodeRender("{{ site.makecode.home_url }}", "{{ site.github.owner_name }}/{{ site.github.repository_name }}");</script>

About

MakeCode Library for Adafruit ssd1306 oled version with a reset pin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages