Example Code for Raspberry Pi-Get gesture by polling
Last revision 2026/01/22
Get gesture by polling
Hardware Preparation
- Raspberry Pi 4 Model B (or similar) × 1
- Fermion: GR10-30 Gesture Sensor × 1
- DuPont Wires × 1
Software Preparation
Wiring Diagram
Connect the module to the Raspberry Pi according to the connection diagram.
Other Preparation Work
-
Enable I2C of Raspberry Pi. Skip this step if it is already enabled. Open terminal and input the following command and press Enter:
pi@raspberrypi:~ $ sudo raspi-config
Then use the UP/Down keys to select "5 Interfacing Options", press Enter, select "P5 I2C" and press Enter to comfirm "Yes". Reboot the Raspberry Pi board. -
To install Python dependency library and git, the Raspberry Pi needs to be connected to the Internet. Skip this step if they're already installed. In the terminal, input the following command and press Enter:
pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get install build-essential python-dev python-smbus git -
Download DFRobot_GR10_30 driver library. In the terminal, input the following command and press Enter:
pi@raspberrypi:~ $ cd Desktop/
pi@raspberrypi:~/Desktop $ git clone https://github.com/DFRobot/DFRobot_GR10_30
Sample Code
In the terminal, input the following command and press Enter to run the sample code:
pi@raspberrypi:~/Desktop $ cd DFRobot_GR10_30/python/raspberry/example/
pi@raspberrypi:~/Desktop/DFRobot_GR10_30/python/raspberry/example/ $ python get_getures.py
Was this article helpful?
