Professional Documents
Culture Documents
Rpi Garage
Rpi Garage
**Step-by-Step Instructions**:
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT) # Set GPIO17 as an output pin
def operate_garage_door():
GPIO.output(17, GPIO.HIGH) # Activate the relay (close the circuit)
time.sleep(0.5) # Adjust the delay if needed
GPIO.output(17, GPIO.LOW) # Deactivate the relay (open the circuit)
try:
while True:
user_input = input("Press Enter to operate the garage door (Ctrl+C to
exit)...")
operate_garage_door()
except KeyboardInterrupt:
print("\nExiting the program.")
finally:
GPIO.cleanup() # Clean up GPIO settings on program exit
```
Remember to exercise caution and prioritize safety when working on this project.
It's essential to ensure that the garage door opener functions reliably and does
not pose any safety risks.