In this example we show an example written in Micropython using the uPycraft IDE. This time we will be trying out the Wemos OLED shield connected to a Wemos Mini.
Requirements
Lets take a look a the shields and boards that are required for this project
Parts List
I connect the Wemos Mini to the dual base and then put the OLED shield along side this. You can connect the OLED shield directly to the Wemos Mini if you want.
Code
This is a basic example
[codesyntax lang=”python”]
from machine import Pin,I2C import ssd1306 i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000) #Init i2c lcd=ssd1306.SSD1306_I2C(64,48,i2c) #create LCD object,Specify col and row lcd.text("ESP8266",0,0) lcd.text("test",0,16) lcd.text("123456",0,32) lcd.show() #display
[/codesyntax]
and another example
[codesyntax lang=”python”]
import time from machine import Pin, I2C from ssd1306 import SSD1306_I2C width = 64 height = 48 i2c = I2C(scl=Pin(5), sda=Pin(4)) oled = SSD1306_I2C(width, height, i2c) oled.fill(1) oled.show() time.sleep(2) oled.fill(0) oled.show() time.sleep(2) oled.pixel(0, 0, 1) oled.show() time.sleep(2) oled.pixel(63, 47, 1) oled.show() time.sleep(2) oled.text('Hello', 0, 0) oled.text('World', 0, 10) oled.show() time.sleep(2) oled.invert(True) time.sleep(2) oled.invert(False)
[/codesyntax]