In SP2302, it includes a 40-pin GPIO (general-purpose input/output) header that are pin to pin compatible with Raspberry Pi. The GPIO headers on all boards have a 2.54mm pin pitch.
GitHub Reference link: GPIO reference code
The Blue Boxes are the default feature for SP2302. It includes GPIOs, SPI, I2C, PWM and UART interface. We will have specific section for each communication methods.
Optional Features:The Purple Boxes are the optional that could be set during programming SP2302. It includes all available GPIO pins and other optional features.
Extra Features:The Green Boxes are the extra features that could be set during programming SP2302.
How to configure GPIO Pins in Python:For configure the GPIO Pins, there are three main steps to make it happen. For details, please refer to our GitHub Site.
1. Please use pip to download the “gpiod” library
Command: pip install gpiod
2. Set the GPIO pins – Selecting the wanted pin to be a GPIO pin and set it as output.
3. Set the GPIO pins - Set the GPIO value (Turn On / Off the GPIO output)
4. Control the GPIO – We need to have a function for configuring the GPIO pins
5. Test the GPIO pin with a LED light blue.
a) Testing Environment Setup: We will connect GPIO3 in Pin 11 with the LED. We could check the GPIO status determine by the Light’s status.
b) Python3 with command to Turn on GPIO3:
Command: python3 gpio_control.py 3 1
c) Python3 with command to Turn off GPIO3:
Command: python3 gpio_control.py 3 0
Comments