Skip to content

1010Technologies/pxt-makerbit-lcd2004

Repository files navigation

MakerBit LCD2004

Build Status

MakeCode extension for I2C LCD 2004 displays.

MakerBit Board

The MakerBit connects to the BBC micro:bit to provide easy connections to a wide variety of sensors, actuators and other components, for example a LCD display.

http://makerbit.com/

MakerBit MakerBit+R
MakerBit MakerBit+R with motor controller

LCD

This extension supports printing text and numbers on an I2C LCD 2004 (4 x 40 characters) display. Displays with I2C address 39 or 63 will work automatically. Use connectLCD to explicitly connect to a different I2C address.

LCD2004

LCD Example

makerbit.setLcdBacklight(LcdBacklight.Off)
makerbit.showStringOnLcd2004("MakerBit", makerbit.position2004(LcdPosition2004.Pos1), 9)
basic.pause(2000)
makerbit.clearLcd2004()

MakerBit connectLcd

Connects to the LCD at a given I2C address. The addresses 39 (PCF8574) or 63 (PCF8574A) seem to be widely used.

makerbit.connectLcd(39)

MakerBit showStringOnLcd2004

Displays a text on a LCD2004 in the given position range. The text will be cropped if it is longer than the provided range. If there is space left, it will be filled with whitespaces.

makerbit.showStringOnLcd2004("Hello world", 40, 59)

MakerBit clearLcd2004

Clears the LCD completely on a LCD2004.

makerbit.clearLcd2004()

MakerBit setLcdBacklight

Enables or disables the backlight of the LCD.

makerbit.setLcdBacklight(LcdBacklight.On)

MakerBit isLcdConnected

Returns true if a LCD is connected. False otherwise.

makerbit.isLcdConnected()

MakerBit lcdMakeCharacter

Create a custom LCD character using a 5x8 pixel matrix.

makerbit.lcdMakeCharacter(LcdChar.c1, image)

MakerBit lcdCharacterPixels

Returns a 5x8 pixel matrix for use as a custom character.

image = makerbit.lcdCharacterPixels()

MakerBit lcdShowCharacter2004

Display a custom character at a specified LCD position.

makerbit.lcdShowCharacter2004(LcdChar.c1, 1)

License

Licensed under the MIT License (MIT). See LICENSE file for more details.

Supported targets

  • for PXT/microbit
  • for PXT/calliope