# #############################################################################
# ** Proyecto : 211 lcd1602
# ** Plataforma : ESP32 / WROOM
# ** Herramienta : https://www.wokwi.com
# ** : Thonny aplicacion de escritorio descargar en www.thonny.org
# ** Compilador : wokwi Simulador online
# ** Version : 1.0
# ** Fecha/Hora : 25-07-2024, 11:05 PM,
# **
# ** E N P R O C E S O - T R A B A J A N D O
# **
# ** Versión : 1
# ** Revisión : A
# ** Release : 0
# ** Bugs & Fixes :
# ** Date : 25/07/2024
# **
# ** By : Jorge Anzaldo
# ** contact : [email protected]
# ** twitter x : @janzaldob
# #############################################################################
# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# : Librerias / Bibliotecas / Modulos | :
# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'''
import machine
from machine import Pin, SoftI2C
from lcd_api import LcdApi
from i2c_lcd import I2cLcd
from time import sleep
# +-------------------------------------------------------------------------------
# | V A R I A B L E S / O B J E T O S - G L O B A L E S |
# +-------------------------------------------------------------------------------
I2C_ADDR = 0x27
totalRows = 2
totalColumns = 16
i2c = SoftI2C(scl=Pin(14), sda=Pin(12), freq=10000)
lcd = I2cLcd(i2c, I2C_ADDR, totalRows, totalColumns)
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# | Definición y Desarrollo de Funciones / Clases |
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ===============================================================================
# || ||
# || P R O G R A M A / F U N C I O N P R I N C I P A L ||
# || ||
# ===============================================================================
while True:
lcd.putstr("HOLA ESIME ")
sleep(2)
lcd.clear()
lcd.putstr("INICIEMOS CON UN CONTADOR ")
sleep(2)
lcd.clear()
for i in range(11):
lcd.putstr(str(i))
sleep(1)
lcd.clear()
'''
import rp2
from rp2 import PIO
from machine import Pin
from time import sleep
# ------ #
# sevseg #
# ------ #
@rp2.asm_pio(set_init=[PIO.IN_HIGH]*4)
def keypad():
wrap_target()
set(y, 0) # 0
label("1")
mov(isr, null) # 1
set(pindirs, 1) # 2
in_(pins, 4) # 3
set(pindirs, 2) # 4
in_(pins, 4) # 5
set(pindirs, 4) # 6
in_(pins, 4) # 7
set(pindirs, 8) # 8
in_(pins, 4) # 9
mov(x, isr) # 10
jmp(x_not_y, "13") # 11
jmp("1") # 12
label("13")
push(block) # 13
irq(0)
mov(y, x) # 14
jmp("1") # 15
wrap()
for i in range(10, 14):
Pin(i, Pin.IN, Pin.PULL_DOWN)
def oninput(machine):
keys = machine.get()
while machine.rx_fifo():
keys = machine.get()
print(hex(keys))
sm = rp2.StateMachine(0, keypad, freq=2000, in_base=Pin(10, Pin.IN, Pin.PULL_DOWN), set_base=Pin(6))
sm.active(1)
sm.irq(oninput)