1import RPi.GPIO as GPIO # IMPORTANT: remember to change the gpio pin (18) also it needs to be programmed in Thonny Python IDE
2import time #used in raspberry pi model 4
3
4GPIO.setwarnings(False) #NOTE: raspberry pi could be updated, and you might need to change your code
5GPIO.setmode(GPIO.BCM)
6GPIO.setup(18, GPIO.OUT)
7
8
9while True:
10 GPIO.output(18, True)
11 time.sleep(1)
12 GPIO.output(18, False)
13 time.sleep(1)
1while True:
2 import RPi.GPIO as GPIO
3 import time
4
5 x = (0.3)
6
7 GPIO.setmode(GPIO.BOARD)
8 GPIO.setup(3, GPIO.OUT)
9 GPIO.setup(5, GPIO.OUT)
10
11 GPIO.output(3, GPIO.LOW)
12 GPIO.output(5, GPIO.HIGH)
13 time.sleep(x)
14 GPIO.output(3,GPIO.HIGH)
15 GPIO.output(5, GPIO.LOW)
16 time.sleep(x)
17
18GPIO.cleanup()
19