You can use the capacitive touch pad on the SHT4x Trinkey in Arduino with the Adafruit_FreeTouch library. This page has example code that monitors the incoming value on the pad, letting you use it as an input.
Touch Pad Location
The capacitive touch pad is located on the opposite end of the Trinkey from the USB port.
Library Installation
You can install the Adafruit_FreeTouch library for Arduino using the Library Manager in the Arduino IDE.
Click the Manage Libraries ... menu item, search for Adafruit_FreeTouch, and select the Adafruit FreeTouch library:
There are no additional dependencies for the Adafruit FreeTouch Library.
// SPDX-FileCopyrightText: 2024 Limor Fried for Adafruit Industries // // SPDX-License-Identifier: MIT #include <Adafruit_FreeTouch.h> Adafruit_FreeTouch touch = Adafruit_FreeTouch(1, OVERSAMPLE_4, RESISTOR_50K, FREQ_MODE_NONE); void setup() { Serial.begin(115200); while (!Serial) { delay(10); // will pause until serial console opens } if (! touch.begin()) { Serial.println("Failed to begin QTouch on pin 1"); } } void loop() { Serial.println(touch.measure()); delay(1000); }
Upload the sketch to your board and open up the Serial Monitor (Tools -> Serial Monitor) at 115200 baud. You'll see the values printed to the Serial Monitor from the capacitive touch pad. If you touch the pad, you'll see the value increase. Otherwise it tends to hover below 200
.
Text editor powered by tinymce.