Example Code for Raspberry Pi-Get gesture by interrupt

Last revision 2026/01/22

Get gesture by interrupt

Hardware Preparation

Software Preparation

Wiring Diagram

Connect the module to the Raspberry Pi according to the connection diagram.

Other Preparation Work

  1. 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.

  2. 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

  3. 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 interrupt_get_getures.py

Was this article helpful?

TOP