Running Demo Codes

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

  1. To run the RPi demo on VisionFive 2, you need to replace the import RPi.GPIO as GPIO command with import VisionFive.gpio as GPIO in the RPi Python demo.
  2. Locate to the directory where the test code, RPi_demo_#PWM#_run_on_VisionFive.py, exists:
    1. Execute the following command to get the directory where VisionFive.gpio exists:
      pip show VisionFive.gpio
      Result:
      Location: /usr/local/lib64/python3.9/site-packages
      Note:

      The actual output depends on how the application is installed.

    2. Execute the following to enter the directory, for example, /usr/local/lib64/python3.9/site-packages as indicated in the previous step output:
      cd /usr/local/lib64/python3.9/site-packages
    3. Execute the following command to enter the sample-code directory:
      cd ./VisionFive/sample-code/
  3. Under the sample-code directory, execute the following command to execute the demo code:
    sudo python RPi_demo_#PWM#_run_on_VisionFive.py

    Alternatively, you can execute the following command:

    sudo python3 RPi_demo_#PWM#_run_on_VisionFive.py
    Result:

    The LED blinks and the blink frequency will change according to the PWM frequency.