This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
products:sbc:common:applications:gsensor [2022/07/06 23:42] frank replease Gsensor to G-Sensor |
products:sbc:common:applications:gsensor [2025/02/18 01:40] (current) nick |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== Introduction ===== | ===== Introduction ===== | ||
| - | This document mainly introduces G-Sensor. You will know which node of G-Sensor is, and how to read the value of G-Sensor through C program. | + | By referring to this page, you will know which node of G-Sensor is, and how to read the value of G-Sensor through C program. |
| ===== System Configuration ===== | ===== System Configuration ===== | ||
| - | Check Gsensor | + | Check G-sensor |
| - | ```sh | + | ```shell |
| $ ll / | $ ll / | ||
| crw-rw-rw- 1 root root 10, 50 Mar 18 12:17 /dev/accel | crw-rw-rw- 1 root root 10, 50 Mar 18 12:17 /dev/accel | ||
| Line 16: | Line 16: | ||
| ===== Demo Source Code ===== | ===== Demo Source Code ===== | ||
| - | The source code only realizes the use of default settings to read data, other functions | + | The source code only realizes the use of default settings to read data, for other functions, you can implement |
| ```c gsensor_sample_data.c | ```c gsensor_sample_data.c | ||
| Line 83: | Line 83: | ||
| ``` | ``` | ||
| - | Compile | + | Compile |
| - | ```sh | + | ```shell |
| $ gcc -o gsensor_sample_demo gsensor_sample_demo.c | $ gcc -o gsensor_sample_demo gsensor_sample_demo.c | ||
| ``` | ``` | ||
| Line 93: | Line 93: | ||
| Rotate the board while running, you can see the changes in G-Sensor data. | Rotate the board while running, you can see the changes in G-Sensor data. | ||
| - | ```sh | + | ```shell |
| - | $ ./ | + | $ sudo ./ |
| gsensor node open success!!! | gsensor node open success!!! | ||
| gsensor start sueecss !!! | gsensor start sueecss !!! | ||