Running Demo Code

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

  1. Locate to the directory where the test code, I2C_Sense_Hat.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/
  2. Under the sample-code directory, execute the following command to run the demo code:
    sudo python I2C_Sense_Hat.py

    Alternatively, you can execute the following command:

    sudo python3 I2C_Sense_Hat.py
    Result:

    The temperature and the humidity data are displayed on the terminal:

    [riscv@fedora-starfive sample-code]$ sudo python3 I2C_Sense_Hat.py
    i2c_dev: /dev/i2c-1
    Temperature = 27.85°C , Humidity = 56.59 %
    
    Temperature = 27.83°C , Humidity = 56.60 %
    
    Temperature = 27.85°C , Humidity = 56.61 %
    
    Temperature = 27.86°C , Humidity = 56.60 %
    
    Temperature = 27.86°C , Humidity = 56.60 %
    
    Temperature = 27.80°C , Humidity = 56.60 %
    
    Temperature = 27.87°C , Humidity = 56.60 %