Created
February 14, 2026 15:09
-
-
Save ikizoglu/4c0398b7e4482fd006d35b028882b97f to your computer and use it in GitHub Desktop.
RaspberryPi Röle+LED Kullanımı
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #RaspberryPi Röle+LED Kullanımı | |
| #------------------------------- | |
| import RPi.GPIO as GPIO | |
| import time | |
| GPIO.setwarnings(False) # Ignore warning for now | |
| GPIO.setmode(GPIO.BCM) # Use physical pin numbering | |
| relay = 21 | |
| GPIO.setup(relay,GPIO.OUT) | |
| GPIO.output(relay,False) | |
| print("Relay is working:") | |
| print("------------------") | |
| while True: | |
| GPIO.output(relay,True) | |
| print("Power on") | |
| time.sleep(5) | |
| GPIO.output(relay,False) | |
| print("Power Off") | |
| time.sleep(2) | |
| print("------------") | |
| GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment