test.py 331 B

12345678910
  1. import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library
  2. from time import sleep # Import the sleep function from the time module
  3. GPIO.setwarnings(False)
  4. GPIO.setmode(GPIO.BOARD)
  5. GPIO.setup(8, GPIO.OUT, initial=GPIO.LOW)
  6. while True:
  7. GPIO.output(8, GPIO.HIGH) # Turn on
  8. sleep(1)
  9. GPIO.output(8, GPIO.LOW) # Turn off
  10. sleep(1)