Are you ever in the situation where you need to change your computer volume or press any key, but you are either eating or your hands are dirty so don't want to touch the keyboard? If you have experienced this before, then this project is for you!
In this example, we use gesture sensing to increase/decrease the computer volume. Additionally, you can apply this example to more keyboard inputs such as pressing other commands or typing numbers/letters.
This guide uses a small multipurpose sensor development board called SENSE that can gather over 20 data variables including air quality, sound, light, temperature, proximity, and more. In this application, we will use the gesture sensor.
Step 1: Connections- Connect a Qwiic cable between QTPY SAMD21 and SENSE
- Create a I2C bus between SENSE and OLED Display
- OLED GND -> SENSE GND
- OLD VCC -> SENSE 3V
- OLED SCL -> SENSE SCL
- OLED SDA -> SENSE SDA
Install Code Libraries: (sketch->include library->manage libraries->typename)
- "APDS9960" - Adafruit
- "GFX" - Adafruit
- "SSD1306" - Adafruit
- HID - NicoHood (download from GitHub)
UploadCode
*After the code uploads, open the Serial Monitor and hold your finger on the APDS9960 sensor for 3 seconds to activate it. Then start waving your hand left/right over the sensor to decrease/increase the computer volume.
What's next?Try using the APDS9960_LEFT and APDS_9960_RIGHT controls to add more functionality. For example, maybe a left gesture mutes the audio a right gesture pauses the audio.
Take a look at the HID API for more information.
Comments
Please log in or sign up to comment.