I2C LCD Using micro:bit

If you feel LED matrix on micro:bit is small enough to display any status, you can consider to use I2C LCD.

INTRODUCTION

If you feel LED matrix on micro:bit is small enough to display any status, you can consider to use I2C LCD.

VIDEO

This video will show you how to display text on I2C LCD using micro:bit.

HARDWARE PREPARATION

This is the list of items used in the video.

 

 

 

 

Microbit I2c Lcd Featured

 

 

Sample Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define LCD_ADDR 0x3F
#define LCD_COL 16
#define LCD_ROW 2
LiquidCrystal_I2C lcd(LCD_ADDR, LCD_COL, LCD_ROW);
void setup()
{
Serial.begin(115200);
Serial.println("Display on I2C LCD Using micro:bit");
pinMode(PIN_BUTTON_A, INPUT);
pinMode(PIN_BUTTON_B, INPUT);
lcd.init();
lcd.backlight();
lcd.clear();
lcd.print("Display I2C LCD ");
lcd.setCursor(0, 1);
lcd.print("Using micro:bit ");
delay(2000);
lcd.clear();
lcd.print("Press the");
lcd.setCursor(0, 1);
lcd.print("button");
}
void loop()
{
if (digitalRead(PIN_BUTTON_A) == LOW) {
Serial.println("Button A pressed.");
lcd.clear();
lcd.print("Button A pressed");
while (digitalRead(PIN_BUTTON_A) == LOW);
lcd.clear();
lcd.print("Press the");
lcd.setCursor(0, 1);
lcd.print("button");
delay(100);
}
else if (digitalRead(PIN_BUTTON_B) == LOW) {
Serial.println("Button B pressed.");
lcd.clear();
lcd.print("Button B pressed");
while (digitalRead(PIN_BUTTON_B) == LOW);
lcd.clear();
lcd.print("Press the");
lcd.setCursor(0, 1);
lcd.print("button");
delay(100);
}
}
view raw MicrobitI2CLCD.ino hosted with ❤ by GitHub

This is the sample code used in the video. Please install LiquidCrystal I2C library from Frank de Brabander.

Thank You

References:

  1. LiquidCrystal I2C library from Frank de Brabander

Thanks for reading this tutorial. If you have any technical inquiry, please post at Cytron Technical Forum.

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

DIY Interactive Robot Using REKA:BIT With Micro:bit
BLTouch Installation for Ender 3 with 32-bit V4.2.2 Board
Pick and Send Random Meal’s Option and Locations through Telegram Bot Using Grove WiFi 8266 on micro:bit
DIY Automated Vacuum Cleaner Using REKA:BIT With Micro:bit
Rainbow Spark in Mini House using Maker Uno.
Tutorials of Cytron Technologies Scroll to Top