def DI_INIT(): """ initialize the display. """ global lcd lcd=rgb1602.RGB1602(16,2) #create LCD object,specify col and row
0b00000, 0b00000, 0b01010, 0b00000, 0b00000, 0b10001, 0b01110, 0b00000 ] frownie = [ 0b00000, 0b00000, 0b01010, 0b00000, 0b00000, 0b00000, 0b01110, 0b10001 ] armsDown = [ 0b00100, 0b01010, 0b00100, 0b00100, 0b01110, 0b10101, 0b00100, 0b01010 ] armsUp = [ 0b00100, 0b01010, 0b00100, 0b10101, 0b01110, 0b00100, 0b00100, 0b01010 ] lcd = rgb1602.RGB1602(16, 2) #16 characters and 2 lines of show # create a new character lcd.customSymbol(0, heart) # create a new character lcd.customSymbol(1, smiley) # create a new character lcd.customSymbol(2, frownie) # create a new character lcd.customSymbol(3, armsDown) # create a new character lcd.customSymbol(4, armsUp) #set up the lcd's number of columns and rows: lcd.setCursor(0, 0) # Print a message to the lcd. lcd.printout("I ")
import sys sys.path.append('../') import rgb1602 import time lcd = rgb1602.RGB1602(16, 2) #create LCD object,specify col and row while True: data = raw_input() lcd.clear() lcd.setCursor(0, 0) length = len(data) if length < 17: lcd.printout(data) elif length > 16: lcd.printout(data[:16]) lcd.setCursor(0, 1) lcd.printout(data[16:])
from machine import Pin,I2C import rgb1602 import time i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000) #Init i2c print("========DFRobot ESP8266 I2C LCD1602 TEST===========") lcd=rgb1602.RGB1602(16,2,i2c) #create LCD object,Specify col and row lcd.setRGB(0,50,0); #set the value of RGB lcd.setCursor(0,0) #set the value of coordinates lcd.print("DFRobot") #display "DFRobot" lcd.setCursor(5,1) lcd.print("chengdu") #lcd.home() lcd.print(3322) while True: time.sleep(1) lcd.scrollDisplayLeft() #Set the display mode and scroll direction
import sys sys.path.append('../') import rgb1602 import time colorR = 255 colorG = 0 colorB = 0 lcd = rgb1602.RGB1602(16, 2) lcd.setRGB(colorR, colorG, colorB) # Print a message to the LCD. lcd.printout("hello, world!") time.sleep(1) i = 0 while True: i = i + 1 # set the cursor to column 0, line 1 # (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1) # print the number of seconds since reset: lcd.printout(i) time.sleep(1)
#hardware platform: pyboard V1.1 from pyb import Pin, I2C import rgb1602 import time i2c = pyb.I2C(1, pyb.I2C.MASTER, baudrate=100000) #Init i2c print("========DFRobot pyboard I2C LCD1602 TEST===========") lcd = rgb1602.RGB1602(16, 2, i2c) #create LCD object,Specify col and row lcd.setRGB(0, 50, 0) #set the value of RGB lcd.setCursor(0, 0) #set the value of coordinates lcd.print("DFRobot") #display "DFRobot" lcd.setCursor(5, 1) lcd.print("chengdu") #lcd.home() lcd.print(3322) while True: time.sleep(1) lcd.scrollDisplayLeft() #Set the display mode and scroll direction
#hardware platform: FireBeetle-ESP32 from machine import Pin, I2C import rgb1602 import time i2c = I2C(scl=Pin(22), sda=Pin(21), freq=100000) #Init i2c print("========DFRobot ESP32 I2C LCD1602 TEST===========") lcd = rgb1602.RGB1602(16, 2, i2c) #create LCD object,Specify col and row lcd.setRGB(0, 50, 0) #set the value of RGB lcd.setCursor(0, 0) #set the value of coordinates lcd.print("DFRobot") #display "DFRobot" lcd.setCursor(5, 1) lcd.print("chengdu") #lcd.home() lcd.print(3322) while True: time.sleep(1) lcd.scrollDisplayLeft() #Set the display mode and scroll direction