Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:common:applications:gsensor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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 [2026/02/03 22:53] (current)
gray update by using AI
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.+This guide explains how to identify the G-Sensor device node and read acceleration data from it using a C program.
  
 ===== System Configuration ===== ===== System Configuration =====
  
-Check Gsensor node.+Verify the G-Sensor device node exists:
  
-```sh+```shell
 $ ll /dev/accel  $ ll /dev/accel 
 +```
 +Expected output:
 +```shell
 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 19:
 ===== Demo Source Code ===== ===== Demo Source Code =====
  
-The source code only realizes the use of default settings to read data, other functions users can implement by yourself.+The following sample program demonstrates reading data from the G-Sensor using default settings. You can extend it to implement other functions.
  
 ```c gsensor_sample_data.c ```c gsensor_sample_data.c
Line 83: Line 86:
 ``` ```
  
-Compile+Compile the program:
  
-```sh+```shell
 $ gcc -o gsensor_sample_demo gsensor_sample_demo.c $ gcc -o gsensor_sample_demo gsensor_sample_demo.c
 ``` ```
Line 91: Line 94:
 ===== Demonstrate ===== ===== Demonstrate =====
  
-Rotate the board while running, you can see the changes in G-Sensor data.+Run the compiled program. While it is running, tilt or move the board to observe changes in the acceleration values.
  
-```sh +```shell 
-$ ./gsensor_sample_demo+sudo ./gsensor_sample_demo
 gsensor node open success!!! gsensor node open success!!!
 gsensor start sueecss !!! gsensor start sueecss !!!
Last modified: 2022/07/06 23:42 by frank