40pin IO Development
Experiment 01 - GPIO Output (LED Blinking)
Hardware Connection
Connect the LED bulb to VCC, GND, and IO37 on the RDK-X5 mainboard.
Software Operation
Enter the user home directory and run:
cd usersudo python3 ./LED_out.py
Terminal as shown:

At this point, the LED bulb starts 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)
# Define GPIO channel 37
output_pin = 37 # BOARD pin 37
def main():
# Set pin numbering mode to BOARD
GPIO.setmode(GPIO.BOARD)
# Set as output and initialize to high level
GPIO.setup(output_pin, GPIO.OUT, initial=GPIO.HIGH)
# Record current pin state
curr_value = GPIO.HIGH
print("Starting demo now! Press CTRL+C to exit")
try:
# Toggle LED every 1 second
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()