GPIO Pull up/down Test
This section describes how to use the demo program to test the GPIO pull up and pull down (PUD) function.
Hardware Setup
Make sure pin 31 of the 4--pin header is in a suspended state (not wired).
Run Demo Code
Perform the following steps on Debian of VisionFive 2 or VisionFive 2 Lite.
-
Locate the directory where the test code,
pud_test.py, exists.-
Source into the Python3 Virtual Environment.
source ./myvenv/bin/activate -
Install the dependency.
python3 -m pip install pillow -
Get the directory where
VisionFive.gpioexists.python3 -m pip show VisionFive.gpioNote: The output depends on how the application is installed. -
Enter the
VisionFive.gpiodirectory.cd <VisionFive.gpiodirectory> -
Enter the
sample-codedirectory.cd ./VisionFive/sample-code/
-
Under the
sample-codedirectory, execute the following command to run the demo code.
Alternatively, you can also run the following command.sudo python pud_test.pysudo python3 pud_test.pyThe terminal displays the following:# python3 pud_test.py *----------------------Start testing------------------------------* Step 1: set input to direction of GPIO pin 31. Step 2: the default input level is HIGH. Step 3.1: set PUD_DOWN to input direction of GPIO pin 31. Step 3.2: the input level with pull_down enabled is LOW. Step 4.1: set PUD_UP to input direction of GPIO pin 31. Step 4.2: the input level with pull_up enabled is HIGH. *---------------------------end test------------------------------*Note: For details about the source code, see edge_detection_with_waiting_time.py Source Code.-
(Optional) Exit the Python3 Virtual Environment.
deactivate