Reference
Library
- RTU Library (Install RTU library when using serial for communication)
- GR10-30 library & sample codes
- GR10-30 Gesture Sensor Python Library
API Description
/**
* @fn enGestures
* @brief Enable gesture
* @param gestures
* GESTURE_UP
* GESTURE_DOWN
* GESTURE_LEFT
* GESTURE_RIGHT
* GESTURE_FORWARD
* GESTURE_BACKWARD
* GESTURE_CLOCKWISE
* GESTURE_COUNTERCLOCKWISE
* GESTURE_WAVE It is not suggested to enable rotation gesture (CW/CCW) and wave gesture at the same time.
* GESTURE_HOVER Disable other gestures when hover gesture enables.
* GESTURE_UNKNOWN
* GESTURE_CLOCKWISE_C
* GESTURE_COUNTERCLOCKWISE_C
* @return NONE
*/
void enGestures(uint16_t gestures);
/**
* @fn getExist
* @brief Get whether the object is in the detection range of sensor
* @return Is the object in the detection range of sensor
* @retval 1 Yes
* @retval 0 No
*/
uint16_t getExist(void);
/**
* @fn getDataReady
* @brief Get if a gesture is detected
* @return Is the gesture detected
* @retval 1 Detected
* @retval 0 Not detected
*/
uint16_t getDataReady(void);
/**
* @fn getGesturesState
* @brief Get gesture type
* @return Gesture type
* @retval GESTURE_UP
* @retval GESTURE_DOWN
* @retval GESTURE_DOWN
* @retval GESTURE_LEFT
* @retval GESTURE_RIGHT
* @retval GESTURE_FORWARD
* @retval GESTURE_BACKWARD
* @retval GESTURE_CLOCKWISE
* @retval GESTURE_COUNTERCLOCKWISE
* @retval GESTURE_WAVE
* @retval GESTURE_HOVER
* @retval GESTURE_UNKNOWN
* @retval GESTURE_CLOCKWISE_C
* @retval GESTURE_COUNTERCLOCKWISE_C
*/
uint16_t getGesturesState(void);
/**
* @fn setUdlrWin
* @brief Set the detection window you want
* @param udSize Distance from top to bottom distance range 0-31
* @param lrSize Distance from left to right distance range 0-31
* @return NONE
*/
void setUdlrWin(uint8_t udSize, uint8_t lrSize);
/**
* @fn setLeftRange
* @brief Set distance of moving to left that can be recognized
* @param range
* @n Distance range 0-31, must be less than distance from left to right of the detection window
* @return NONE
*/
void setLeftRange(uint8_t range);
/**
* @fn setRightRange
* @brief Set distance of moving to right that can be recognized
* @param range
* @n Distance range 0-31, must be less than distance from left to right of the detection window
* @return NONE
*/
void setRightRange(uint8_t range);
/**
* @fn setUpRange
* @brief Set distance of moving up that can be recognized
* @param range
* @n Distance range 0-31, must be less than distance from top to bottom of the detection window
* @return NONE
*/
void setUpRange(uint8_t range);
/**
* @fn setDownRange
* @brief Set distance of moving down that can be recognized
* @param range
* @n Distance range 0-31, must be less than distance from top to bottom of the detection window
* @return NONE
*/
void setDownRange(uint8_t range);
/**
* @fn setForwardRange
* @brief Set distance of moving forward that can be recognized
* @param range
* @n Distance range 0-31
* @return NONE
*/
void setForwardRange(uint8_t range);
/**
* @fn setBackwardRange
* @brief Set distance of moving backward that can be recognized
* @param range
* @n Distance range 0-31
* @return NONE
*/
void setBackwardRange(uint8_t range);
/**
* @fn setWaveNumber
* @brief Set wave number that can be recognized
* @param number
* @n Number range 0-15
* @return NONE
*/
void setWaveNumber(uint8_t number);
/**
* @fn setHovrWin
* @brief Set hover detection window
* @param udSize Distance from top to bottom distance range 0-31
* @param lrSize Distance from left to right distance range 0-31
* @return NONE
*/
void setHovrWin(uint8_t udSize, uint8_t lrSize);
/**
* @fn setHovrTimer
* @brief Set hover time that can trigger the gesture
* @param timer
* @n timer 1-0x3ff 10ms-10s default is 0X3c 600ms
* @return NONE
*/
void setHovrTimer(uint16_t timer);
/**
* @fn setCwsAngle
* @brief Set clockwise rotation angle that can trigger the gesture
* @param count Default is 16 range 1-31
* @n count Rotation angle is 22.5 * count
* @n For example: count = 16 22.5*count = 360 Rotate 360° to trigger the gesture
* @return NONE
*/
void setCwsAngle(uint8_t count);
/**
* @fn setCcwAngle
* @brief Set counterclockwise rotation angle that can trigger the gesture
* @param count Default is 16 range 1-31
* @n count Rotation angle is 22.5 * count
* @n For example: count = 16 22.5*count = 360 Rotate 360° to trigger the gesture
* @return NONE
*/
void setCcwAngle(uint8_t count);
/**
* @fn setCwsAngleCount
* @brief Set clockwise rotation angle that can trigger the gesture
* @param count Default is 4 range 1-31
* @n count The degree of continuous rotation is 22.5 * count
* @n For example: count = 4 22.5*count = 90
* @n Trigger the clockwise/counterclockwise rotation gesture first, if keep rotating, then the continuous rotation gesture will be triggered once every 90 degrees
* @return NONE
*/
void setCwsAngleCount(uint8_t count);
/**
* @fn setCcwAngleCount
* @brief Set counterclockwise rotation angle that can trigger the gesture
* @param count Default is 4 range 1-31
* @n count The degree of continuous rotation is 22.5 * count
* @n For example: count = 4 22.5*count = 90
* @n Trigger the clockwise/counterclockwise rotation gesture first, if keep rotating, then the continuous rotation gesture will be triggered once every 90 degrees
* @return NONE
*/
void setCcwAngleCount(uint8_t count);
Other Supplementary Information
Modbus RTU Protocols
GR10-30 Register Table (V1.0).xlsx
The communication interface uses UART
Sample Code
Sample Code 1 - Get gesture by polling(get_getures.py)
Was this article helpful?
