# Gesture Sensor

## Function introduction

The sensor features advanced gesture detection, proximity detection and digital ambient light sensing. Gesture detection can accurately sense "up, down, left and right" and more complex movements.

<figure><img src="/files/PkkUwMyv5STdkiv37P5B" alt=""><figcaption></figcaption></figure>

## Software setup

1. Install the latest version of the Arduino\_APDS9960 library using the [Arduino IDE](https://www.arduino.cc/en/software)

<div><figure><img src="/files/mY52WauxhYpyNkmamSAq" alt=""><figcaption></figcaption></figure> <figure><img src="/files/U5gTqPNCTTFBy5t7JcLr" alt=""><figcaption></figcaption></figure></div>

2\. Upload the demo sketch (gesture.ino)

<figure><img src="/files/EvfsSYAB3h7mWpxNR7JO" alt=""><figcaption></figcaption></figure>

Of course, you can also compile and upload your own sketch for the gesture sensor.

## Hardware setup

After uploading the the demo sketch, connecting to the NyBoard with wire as shown in the following picture:

<figure><img src="/files/2GMLqckQFHxXxHKtEtaR" alt=""><figcaption></figcaption></figure>

For specific use, the end connected to the sensor can be fixed on the robot's head (included in Bittle's mouth or attached to the top of Nybble's head), of course, you can also use your creativity according to actual needs.

This demo sketch (gesture.ino) implements real-time printing of various directional gestures (up, down, left, and right) made by the user in front of the gesture sensor in the [serial monitor](https://docs.petoi.com/arduino-ide/serial-monitor).

<figure><img src="/files/2IZJ4tVMV9wk3Axrs0ag" alt=""><figcaption></figcaption></figure>

### The demo code

{% file src="/files/AkSDC7TVmaaa4yrBdpYF" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.petoi.com/thai/extensible-modules/gesture-sensor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
