> For the complete documentation index, see [llms.txt](https://docs.petoi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.petoi.com/thai/extensible-modules/gesture-sensor.md).

# 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="https://3127300255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBR9bYMZnmeFFa1GJLvjM%2Fuploads%2FoTOAuKXLMgvqZjEsFMyl%2FGesture_Sensor.png?alt=media&amp;token=6af3b359-84ae-46e4-b2fb-a30026036483" 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="https://3127300255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBR9bYMZnmeFFa1GJLvjM%2Fuploads%2FjVnyHRiggC8gSK2YvwND%2Fimage.png?alt=media&amp;token=70ade8c2-207a-43a8-9588-4b2272f8fb95" alt=""><figcaption></figcaption></figure> <figure><img src="https://3127300255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBR9bYMZnmeFFa1GJLvjM%2Fuploads%2FxMFmwpPdudFfBymLVt4Z%2FAPDS9960%E5%BA%93_en.png?alt=media&amp;token=14452e52-492f-429f-874d-81282d519f51" alt=""><figcaption></figcaption></figure></div>

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

<figure><img src="https://3127300255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBR9bYMZnmeFFa1GJLvjM%2Fuploads%2FhIGEVi47DWC8m9a0mpQt%2Fimage.png?alt=media&amp;token=87b2b722-c730-4b85-a49c-0519256b76c2" 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="https://3127300255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBR9bYMZnmeFFa1GJLvjM%2Fuploads%2F0kgv9DtynA7QZjRGQ6JH%2FGesture_Sensor.jpeg?alt=media&amp;token=004c6853-6cbf-4202-a38d-93abae04b5b3" 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="https://3127300255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBR9bYMZnmeFFa1GJLvjM%2Fuploads%2FEYeHzF47IzhjsWin58r6%2Fimage.png?alt=media&amp;token=ae21860f-9192-4372-94df-11e6ee79ba67" alt=""><figcaption></figcaption></figure>

### The demo code

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
