Welcome to RDK S600 Developer Kit repository
2.7 Examples of GPIO Read and Write Operations
Example of GPIO Read and Write Operations
Example of GPIO Read and Write Operations1. Expansion Pin Header Definition2. GPIO Read And Write Operation Example3. Environment Setup4. How to Run5. Expected Outcome
The development board features expansion pin headers, allowing users to perform peripheral expansions. Refer to this chapter for interface definitions.
1. Expansion Pin Header Definition
The RDKS600 has two 10-pin self-locking interfaces, one 12-pin self-locking interface, and one 14-pin self-locking interface, making it convenient for users to expand peripherals. The digital I/O is designed with a 1.8V logic level. The interface definitions are as follows:

2. GPIO Read And Write Operation Example
In the development board's /app/40pin_samples/ directory, various functional test codes for PIN pins are pre-installed, including GPIO input/output tests, I2C, SPI, UART, and other tests. All test programs are written in Python. Refer to other sections of this chapter for more details.
Take /app/40pin_samples/button_led.py as an example. This program configures pin 4 as input and pin 3 as output, controlling the output state of pin 3 based on the input state of pin 4.
3. Environment Setup
Use a jumper wire to connect pin 4 to 1.8V or GND to control its high/low logic level.
4. How to Run
Execute the button_led.py program to start the GPIO read/write program.
root@ubuntu:~# cd /app/40pin_samples/root@ubuntu:/app/40pin_samples# sudo python3 ./button_led.py
5. Expected Outcome
By controlling the high/low logic level of pin 4, you can change the output logic level of pin 3.
xxxxxxxxxxroot@ubuntu:/app/40pin_samples# ./button_led.pyStarting demo now! Press CTRL+C to exitOutputting 1 to Pin 3Outputting 0 to Pin 3Outputting 1 to Pin 3