Lesson 6: LCD display

Objective

Using Grove - 16x2 LCD display to display "Hello World" message.

Hardware requirements

Prepare:

  • MicroUSB cable
  • Raspberry Pi 3 Model B
  • Computer

Set contents

  • Grove Base Hat
  • Grove wire
  • Grove - LCD display 16*2

Connecting equipment

Step 1 Connect Grove - 16*2 LCD display to I2C port on Base Hat.

Step 2 Connect Base Hat to Raspberry Pi.

Step 3 Connect Raspberry Pi to the power supply using a micro USB cable.

Software

Note

Make sure you clone the python.py repository library on your Raspberry Pi.

Step 1: Enter the following commands to open the python file

cd grove.py
nano lesson_6.py

Step 2: Copy the following code

#!/usr/bin/env python

import time

from grove.display.jhd1802 import JHD1802

def main():
    # Grove - 16x2 LCD(White on Blue) connected to I2C port
    lcd = JHD1802()

    lcd.setCursor(0, 0)
    lcd.write('hello, world!!!')

    print('application exiting...')

if __name__ === '__main__':
    main()

Step 3:Włączprogram

sudo chmod +x lesson_6.py
sudo ./lesson_6.py

You should see "hello, world!" on the LCD.

If you want to use Grove - LCD 16*2 to display other symbols, just change lcd.write( 'hello, world!!!') in the code.

Table of contents

Botland.store - shop for makers!