Welcome to RDK X3 Board repository
2.10 GPIO read write
2.10 GPIO read write
In the /app/40pin_stamples/ directory of the development board, various functional testing codes for 40PIN pins are pre-set, including input/output testing for gpio, PWM, I2C, SPI, UART, and other tests. All test programs are written in Python language.
Taking /app/40pin_stamples/button_1ed. py as an example, this program configures pin 38 as input and pin 36 as output, and controls the output state of pin 36 based on the input state of pin 38.
1. Preparation
Connect pin 38 to 3.3V or GND using a DuPont wire to control its high and low voltage levels.

2. Run mode
Execute the button_1ed. py program to start GPIO read-write programs.
sunrise@ubuntu:~$ cd /app/40pin_samples/sunrise@ubuntu:/app/40pin_samples$ sudo python3 ./button_led.py3. Result
By controlling the high and low levels of pin 38, the output level of pin 36 can be changed.
xxxxxxxxxxsunrise@ubuntu:/app/40pin_samples$ sudo python3 ./button_led.pyStarting demo now! Press CTRL+C to exitOutputting 0 to Pin 36Outputting 1 to Pin 36Outputting 0 to Pin 36