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.
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F3127300255-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FBR9bYMZnmeFFa1GJLvjM%252Fuploads%252FoTOAuKXLMgvqZjEsFMyl%252FGesture_Sensor.png%3Falt%3Dmedia%26token%3D6af3b359-84ae-46e4-b2fb-a30026036483&width=768&dpr=4&quality=100&sign=a945a4f0&sv=1)
Software setup
Install the latest version of the Arduino_APDS9960 library using the Arduino IDE
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F3127300255-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FBR9bYMZnmeFFa1GJLvjM%252Fuploads%252FjVnyHRiggC8gSK2YvwND%252Fimage.png%3Falt%3Dmedia%26token%3D70ade8c2-207a-43a8-9588-4b2272f8fb95&width=768&dpr=4&quality=100&sign=8d751ba4&sv=1)
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F3127300255-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FBR9bYMZnmeFFa1GJLvjM%252Fuploads%252FxMFmwpPdudFfBymLVt4Z%252FAPDS9960%25E5%25BA%2593_en.png%3Falt%3Dmedia%26token%3D14452e52-492f-429f-874d-81282d519f51&width=768&dpr=4&quality=100&sign=bace6f6b&sv=1)
2. Upload the demo sketch (gesture.ino)
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F3127300255-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FBR9bYMZnmeFFa1GJLvjM%252Fuploads%252FhIGEVi47DWC8m9a0mpQt%252Fimage.png%3Falt%3Dmedia%26token%3D87b2b722-c730-4b85-a49c-0519256b76c2&width=768&dpr=4&quality=100&sign=3824beda&sv=1)
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:
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F3127300255-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FBR9bYMZnmeFFa1GJLvjM%252Fuploads%252F0kgv9DtynA7QZjRGQ6JH%252FGesture_Sensor.jpeg%3Falt%3Dmedia%26token%3D004c6853-6cbf-4202-a38d-93abae04b5b3&width=768&dpr=4&quality=100&sign=41a84449&sv=1)
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/~gitbook/image?url=https%3A%2F%2F3127300255-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FBR9bYMZnmeFFa1GJLvjM%252Fuploads%252FEYeHzF47IzhjsWin58r6%252Fimage.png%3Falt%3Dmedia%26token%3Dae21860f-9192-4372-94df-11e6ee79ba67&width=768&dpr=4&quality=100&sign=20d74672&sv=1)
The demo code
Last updated