import time
import network
import ssd1306
from machine import Pin, I2C
from umqtt.simple import MQTTClient
# Modify wherever the values contain <>
MQTT_BROKER = "broker.hivemq.com"
MQTT_CLIENT_ID = "keypad-<class>-<number in class>-<name>"
MQTT_TOPIC = "elsys/<class>/<number in class>/<name>"
# Keypad constants - Update them according to the schematics
ROW_PINS = [?]
COL_PINS = [?]
KEY_MAP = [
['1', '2', '3'],\
['4', '5', '6'],\
['7', '8', '9'],\
['*', '0', '#']
]
# Display Constants - Update them according to the schematics
DISPLAY_SCL_PIN = ?
DISPLAY_SDA_PIN = ?
DISPLAY_WIDTH = 128
DISPLAY_HEIGHT = 64
# Connect to Wi-Fi
def connect_to_wifi():
print("Connecting to Wi-Fi", end="")
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect('Wokwi-GUEST', '')
while not sta_if.isconnected():
print(".", end="")
time.sleep(0.1)
print(" Connected!")
# Start writing your code below ...
Loading
ssd1306
ssd1306