Reference

Last revision 2026/01/15

Library

Communication Protocol Description

Serial Protocol Format: 9600 band rate; 8 data bits, no parity bit, 1 stop bit.

API Description

  • setGestureDistance: Set the sensing height (default 20cm when powered on). Example: DFGT.setGestureDistance(20) (Unit: cm; Max height: 30cm).
  • setSleep: Set the sleep enablement or enter auto-sleep mode (sleep mode disabled when powered on). Example: DFGT.setSleep(4) (Unit: s).
  • enableFunction: Set gesture sensing enablement (all the seven gestures can be recognized when powered on). Example 1: DFGT.enableFunction(DFGT_FUN_ALL) (enable all gestures sensing function); Example 3: DFGT.enableFunction(DFGT_FUN_RIGHT | DFGT_FUN_LEFT) (enable sensing function of part gestures).
  • disableFunction: Disable sensing function of part gestures. Example 2: DFGT.disableFunction(DFGT_FUN_RIGHT | DFGT_FUN_LEFT).
  • getAnEvent: Get an event that data saved in serial buffer. Example: int8_t rslt = DFGT.getAnEvent().
  • Abnormality might occur when using the module in strong sunlight condition due to its working principle;
  • When powered down, the sensor will be initialized automatically and the previous setting will be invalid.
  • When sending byte constinuously, there should be at least 200us time interval between the end of the last byte and the starting of the next byte; The sensor can receive/transmit data only in working state, while for processing data, we must make the sensor stay in non-working state. That is to say, if there is an object over the sensor when receiving/transmitting data, we need to move it away for completing the following settings.

Was this article helpful?

TOP