> For the complete documentation index, see [llms.txt](https://kawsing.gitbook.io/opensystem/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kawsing.gitbook.io/opensystem/andoid-shou-ji/shu-mei-pai/gpio-led.md).

# GPIO LED

```python
import RPi.GPIO as GPIO
import time

# blinking function
def blink(pin):
        GPIO.output(pin,GPIO.HIGH)
        time.sleep(1)
        GPIO.output(pin,GPIO.LOW)
        time.sleep(1)
        return

# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)

# set up GPIO output channel, we set GPIO4 (Pin 7) to OUTPUT
GPIO.setup(7, GPIO.OUT)

# blink GPIO4 (Pin 7) 50 times
for i in range(0,50):
        blink(7)

GPIO.cleanup()

```

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-MPHdsono5vBkSLTFyGy%2F-MPHp3Ptj6S66_CMbix3%2Fimage.png?alt=media\&token=d96b1edd-11c7-4b59-99c1-d592098b7304)
