| 9 - Peripheral Examples
Figure 9-2 Connect Sense Hat (B) to the 40-Pin Header
9.1.2. Running Example with Sense Hat (B)
Take SHTC3 sensor as an example:
1. Download the source code from:
2. (Optional) Install the tool to compile. The following is an example to install:
sudo apt-get install gcc-riscv64-linux-gnu
Note:
This step can be skipped if the tool has been installed.
3. Execute the following to compile:
riscv64-linux-gnu-gcc SHTC3_dev.c -o shtc3
Result:
The output file is
shtc3
in the same directory.
4. Copy the executable code from the shtc3 file to the board, and change the execution permission by executing the
following command:
chmod +x shtc3
5. Execute the following command to run:
./shtc3
Result:
The following output indicates the execution is successful:
root@starfive:~# ./shtc3
SHTC3 Sensor Test Program ...
Fopen : /dev/i2c-0
© 2018-2022 StarFive Technology
All rights reserved
34
StarFive