Home automation with relay modules
📖 Scenario: You have a Raspberry Pi connected to 3 relay modules. Each relay controls a different home appliance: a lamp, a fan, and a heater. You want to write a simple program to turn these appliances on or off based on a list of commands.
🎯 Goal: Build a Python program that stores the relay pins and appliance names, sets a command to turn appliances on or off, applies the commands using a loop, and prints the final states of each appliance.
📋 What You'll Learn
Create a dictionary with relay pins as keys and appliance names as values
Create a dictionary with appliance names as keys and their desired states ('ON' or 'OFF') as values
Use a for loop to iterate over the relay pins and appliances
Print the appliance name and its final state
💡 Why This Matters
🌍 Real World
Home automation systems use relay modules to control appliances like lights, fans, and heaters remotely or automatically.
💼 Career
Understanding how to control hardware with code is important for jobs in IoT, embedded systems, and home automation engineering.
Progress0 / 4 steps