Running Demo Code

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

  1. Locate to the directory where the test code, 2.4inch_LCD_demo, 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/
    4. Execute the following command to enter the directory where the test code, 2.4inch_LCD_demo, exists:
      cd ./lcddemo/example/
  2. Under the sample-code directory, execute the following command to execute the demo code:
    sudo python 2.4inch_LCD_demo

    Alternatively, you can execute the following command:

    sudo python3 2.4inch_LCD_demo
    Result:
    • On the 2.4inch LCD:
      • First, the following picture with the StarFive logo will be displayed for two seconds.
        Figure 1. Example Output
      • Then the following two official example figures will be displayed in turn.
        Figure 2. Example Output
    • The terminal output is as the following.
      -----------lcd demo-----------
      Set SPI mode successfully
      spi mode: 0x0 
      bits per word: 8
      max speed: 40000000 Hz(40000 kHz)
      2022-07-04 16:40:40 
      2022-07-04 16:40:41 
      2022-07-04 16:40:41 
      2022-07-04 16:40:42 
      2022-07-04 16:40:42 
      2022-07-04 16:40:43 
      2022-07-04 16:40:44 
      2022-07-04 16:40:44 
      2022-07-04 16:40:45

      The output indicates:

      • that the SPI mode is set successfully
      • the SPI mode
      • the date and time when all the above three figures are displayed