[Micro:bit extension for the Sparkfun 16x2 SerLCD - RGB Backlight LCD Display]
Open this page at https://evergreen22.github.io/pxt-lcd-rgb-16x2-i2c/
This repository can be added as an extension in MakeCode.
- open https://makecode.microbit.org/
- click on New Project
- click on Extensions under the gearwheel menu
- search for https://github.com/evergreen22/pxt-lcd-rgb-16x2-i2c and import
let Fahrenheit = 0
LcdRgb16x2.lcdInit(114)
LcdRgb16x2.backlightOn()
LcdRgb16x2.clearLCD()
basic.forever(function () {
Fahrenheit = input.temperature() * 1.8 + 32
LcdRgb16x2.showString("Temp: " + convertToText(Fahrenheit))
LcdRgb16x2.setCursor(0, 0)
basic.pause(5000)
})
Use a Flexible Qwiic Cable and a micro:bit breakout with headers to connect your LCD display to the micro:bit with a breadboard.
Wire color | Connection |
---|---|
Red | 3V (power) |
Black | GND (ground) |
Blue | P20 (SDA) |
Yellow | P19 (SCL) |
The LCD must be initialized before it will work. Initialize the display with the set LCD address
block as shown below. The address is preset to the default.
LcdRgb16x2.lcdInit(114)
The LCD display has a feature called System Messages that is used to troubleshoot the display. Every time a display setting is changed it is confirmed on the display.
To turn system messages off, use the LCD system messages off
block. The display remembers this setting so you only need to disable it once. If you want to turn it back on, use the LCD system messages on
block.
LcdRgb16x2.lcdInit(114)
LcdRgb16x2.systemMessagesOff()
LCD displays are very slow (in computer terms) and may take several milliseconds (ms) to complete a task. If your screen is garbled try turning off system messages (see the answer above) or inserting a pause before showing a number or text.
LcdRgb16x2.lcdInit(114)
basic.pause(1000)
LcdRgb16x2.showString("Hello World")
To edit this repository in MakeCode.
- open https://makecode.microbit.org/
- click on Import then click on Import URL
- paste https://github.com/evergreen22/pxt-lcd-rgb-16x2-i2c and click import
LcdRgb16x2 extension Copyright (C) 2022 James A. Jerkins
- for PXT/microbit