Skip to content

Instantly share code, notes, and snippets.

@netomarin
Created April 20, 2017 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netomarin/490ab2af4f5aefb80561aef15de9c2f5 to your computer and use it in GitHub Desktop.
Save netomarin/490ab2af4f5aefb80561aef15de9c2f5 to your computer and use it in GitHub Desktop.
Exemplo de uso de display LCD I2C 20x4 com módulo PCF8574 em Python para Raspberry Pi
# Classe do branch que é compativel com o modulo PCF8574
import Adafruit_CharLCD.PCF_CharLCD as LCD
# Valores de configuracao
address = 0x3f
busnum = 1
lines = 4
cols = 20
# E se estiver usando um 2x16
#lines = 2
#cols = 16
# Inicializacao da classe que realizara a comunicacao
lcd = LCD.PCF_CharLCD(0, address=address, busnum=busnum, cols=cols, lines=lines)
# Iniciando com a limpeza da tela
lcd.clear()
# Exibindo uma simples mensagem
lcd.message(' Hello from')
# Mudanca de linha com \n
lcd.message('\n Neto Marin')
# Ou definindo a posicao do cursor para centralizar
lcd.set_cursor(5,2)
lcd.message('@netomarin')
# E tambem para posicionar no inicio da linha
lcd.set_cursor(0,3)
lcd.message('www.netomarin.com.br')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment