Running Demo Code

To run the demo code, perform the following on VisionFive 2 Debian:

  1. Locate to the directory where the code, led.py, exists:
    1. Source into the Python3 Virtual Environment:
      source ./myvenv/bin/activate
    2. Execute the following command to install dependency:
      python3 -m pip install pillow
    3. Execute the following command to get the directory where VisionFive.gpio exists:
      python3 -m pip show VisionFive.gpio
      Result:
      Location: /home/user/myvenv/lib/python3.11/site-packages
      Note:

      The actual output depends on how the application is installed.

    4. Execute the following to enter the directory, for example, /home/user/myvenv/lib/python3.11/site-packages as indicated in the previous step output:
      cd /home/user/myvenv/lib/python3.11/site-packages
    5. Execute the following command to enter the sample-code directory:
      cd ./VisionFive/sample-code/
  2. Under the sample-code directory, execute the following command:
    sudo python led.py

    Alternatively, you can execute the following command:

    sudo python3 led.py
  3. Enter the period (unit: second) to configure the time when the LED is turning off or on.
    For example, enter 2. The following is the example output:
    [riscv@fedora-starfive sample-code]$ sudo python3 led.py
    Enter delay(seconds): 2
    
    Result:

    The LED turns on and off in 2 second intervals.

  4. (Optional) Exit the Python3 Virtual Environment.
    deactivate