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 = "relay-<class>-<number in class>-<name>"
MQTT_TOPIC = "elsys/<class>/<number in class>/<name>"
# Relay Constants - Update according to the schematics
RELAY_IN_PIN = ?
# Display Constants - Update according to the schematics
DISPLAY_SCL_PIN = ?
DISPLAY_SDA_PIN = ?
DISPLAY_WIDTH = 128
DISPLAY_HEIGHT = 64
# Roles
ROLES = {
"123#": "Janitor",
"456#": "Security Guard"
}
# 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 ...