import board import busio import adafruit_character_lcd # Character LCD Config: # modify this if you have a different sized charlcd lcd_columns = 16 lcd_rows = 2 # Initialize I2C bus. i2c = busio.I2C(board.SCL, board.SDA) # Init the lcd class lcd = adafruit_character_lcd.Character_LCD_I2C(i2c, lcd_columns, lcd_rows) # Print a 2x line message lcd.message('hello\ncircuitpython') # Wait 5s time.sleep(5) # Demo showing cursor lcd.clear() lcd.show_cursor(True) lcd.message('showing cursor ') # Wait 5s time.sleep(5) # Demo showing the blinking cursor lcd.clear() lcd.blink(True) lcd.message('Blinky Cursor!')
""" import time import adafruit_character_lcd import board import busio import pulseio ez1pin = board.D1 # Trinket GPIO #1 # i2c LCD initialize bus and class i2c = busio.I2C(board.SCL, board.SDA) cols = 16 rows = 2 lcd = adafruit_character_lcd.Character_LCD_I2C(i2c, cols, rows) # calculated mode or median distance mode_result = 0 # pulseio can store multiple pulses # read in time for pin to transition samples = 18 pulses = pulseio.PulseIn(board.D1, maxlen=samples) # sensor reads which are in range will be stored here rangevalue = [0, 0, 0, 0, 0, 0, 0, 0, 0] # 25ms sensor power up pause time.sleep(.25)