Simple test

Ensure your device works with this simple test.

examples/waveshare_lcd1602_simpletest.py
 1# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
 2# SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc
 3#
 4# SPDX-License-Identifier: Unlicense
 5
 6import time
 7import board
 8from rainbowio import colorwheel
 9import waveshare_LCD1602
10
11"""Default I2C ports on boards that have one"""
12i2c = board.I2C()
13
14lcd = waveshare_LCD1602.LCD1602(i2c, 16, 2)
15lcd.setRGB(255, 255, 0)
16lcd.setCursor(0, 0)
17lcd.printout("Waveshare")
18lcd.setCursor(0, 1)
19lcd.printout("Hello World !")
20
21while True:
22    color = colorwheel(time.monotonic() * 16)
23    lcd.setRGB(*color.to_bytes(3, "big"))
24    time.sleep(1)