40-pin IO Development
Experiment 01 - GPIO Output (LED Blink)
Hardware Connection
Connect the LED to the VCC, GND, and IO37 of the RDK-X5 board.
Software Execution
Enter the user home directory and run:
cd usersudo python3 ./LED_out.py
Terminal output:

You will see the LED start blinking at one-second intervals.
#!/usr/bin/env python3
import sys
import signal
import Hobot.GPIO as GPIO
import time
def signal_handler(signal, frame):
sys.exit(0)
# 定义使用的GPIO通道为37
output_pin = 37 # BOARD 编码 37
def main():
# 设置管脚编码模式为硬件编号 BOARD
GPIO.setmode(GPIO.BOARD)
# 设置为输出模式,并且初始化为高电平
GPIO.setup(output_pin, GPIO.OUT, initial=GPIO.HIGH)
# 记录当前管脚状态
curr_value = GPIO.HIGH
print("Starting demo now! Press CTRL+C to exit")
try:
# 间隔1秒时间,循环控制LED灯亮灭
while True:
time.sleep(1)
GPIO.output(output_pin, curr_value)
curr_value ^= GPIO.HIGH
finally:
GPIO.cleanup()
if __name__=='__main__':
signal.signal(signal.SIGINT, signal_handler)
main()