|
| 1 | +# Summary |
| 2 | + |
| 3 | + Members | Descriptions |
| 4 | +--------------------------------|--------------------------------------------- |
| 5 | +`class ` [`CapacitiveTouch`](#class_capacitive_touch) | A user-friendly class for capacitive touch sensing. |
| 6 | + |
| 7 | +# class `CapacitiveTouch` <a id="class_capacitive_touch" class="anchor"></a> |
| 8 | + |
| 9 | +A user-friendly class for capacitive touch sensing. |
| 10 | + |
| 11 | +Create an instance with: <br/>[CapacitiveTouch](#class_capacitive_touch) ct = [CapacitiveTouch(LOVE_BUTTON)](#class_capacitive_touch); |
| 12 | + |
| 13 | +## Summary |
| 14 | + |
| 15 | + Members | Descriptions |
| 16 | +--------------------------------|--------------------------------------------- |
| 17 | +| [`CapacitiveTouch`](#class_capacitive_touch_1ac22af64579b04c74118d037b1a8715f2) | Constructs a capacitive touch sensor for the given pin. | |
| 18 | +| [`begin`](#class_capacitive_touch_1a0cce24fac4a98cecf7840ebf435a5d9c) | Initializes the sensor. | |
| 19 | +| [`read`](#class_capacitive_touch_1a5c7b56cc0ad47963fa0b97abe2909aba) | Reads the raw sensor value. | |
| 20 | +| [`isTouched`](#class_capacitive_touch_1aab0faf01526c57e1f0f57aa19919d9fa) | Checks if the sensor is touched. | |
| 21 | +| [`setThreshold`](#class_capacitive_touch_1a5f773cd9472164c698811962070f903c) | Sets the detection threshold. | |
| 22 | +| [`getThreshold`](#class_capacitive_touch_1a64a1533e5ea3109c2ff15a3abf22bbba) | Retrieves the current detection threshold. | |
| 23 | + |
| 24 | +## Members |
| 25 | + |
| 26 | +### `CapacitiveTouch` <a id="class_capacitive_touch_1ac22af64579b04c74118d037b1a8715f2" class="anchor"></a> |
| 27 | + |
| 28 | +```cpp |
| 29 | +CapacitiveTouch(uint8_t pin) |
| 30 | +``` |
| 31 | +
|
| 32 | +Constructs a capacitive touch sensor for the given pin. |
| 33 | +
|
| 34 | +#### Parameters |
| 35 | +* `pin` The Arduino pin number (such as LOVE_BUTTON). |
| 36 | +<hr /> |
| 37 | +
|
| 38 | +### `begin` <a id="class_capacitive_touch_1a0cce24fac4a98cecf7840ebf435a5d9c" class="anchor"></a> |
| 39 | +
|
| 40 | +```cpp |
| 41 | +void begin() |
| 42 | +``` |
| 43 | + |
| 44 | +Initializes the sensor. |
| 45 | + |
| 46 | +Configures the pin and initializes the CTSU/DTC hardware. |
| 47 | +<hr /> |
| 48 | + |
| 49 | +### `read` <a id="class_capacitive_touch_1a5c7b56cc0ad47963fa0b97abe2909aba" class="anchor"></a> |
| 50 | + |
| 51 | +```cpp |
| 52 | +int read() |
| 53 | +``` |
| 54 | + |
| 55 | +Reads the raw sensor value. |
| 56 | + |
| 57 | +Initiates a measurement cycle and returns the raw value. |
| 58 | +#### Returns |
| 59 | +int The raw sensor value. |
| 60 | +<hr /> |
| 61 | + |
| 62 | +### `isTouched` <a id="class_capacitive_touch_1aab0faf01526c57e1f0f57aa19919d9fa" class="anchor"></a> |
| 63 | + |
| 64 | +```cpp |
| 65 | +bool isTouched() |
| 66 | +``` |
| 67 | + |
| 68 | +Checks if the sensor is touched. |
| 69 | + |
| 70 | +Compares the raw value to the set threshold. |
| 71 | +#### Returns |
| 72 | +true if the sensor is touched, false otherwise. |
| 73 | +<hr /> |
| 74 | + |
| 75 | +### `setThreshold` <a id="class_capacitive_touch_1a5f773cd9472164c698811962070f903c" class="anchor"></a> |
| 76 | + |
| 77 | +```cpp |
| 78 | +void setThreshold(int threshold) |
| 79 | +``` |
| 80 | +
|
| 81 | +Sets the detection threshold. |
| 82 | +
|
| 83 | +#### Parameters |
| 84 | +* `threshold` The new threshold value. |
| 85 | +<hr /> |
| 86 | +
|
| 87 | +### `getThreshold` <a id="class_capacitive_touch_1a64a1533e5ea3109c2ff15a3abf22bbba" class="anchor"></a> |
| 88 | +
|
| 89 | +```cpp |
| 90 | +int getThreshold() |
| 91 | +``` |
| 92 | + |
| 93 | +Retrieves the current detection threshold. |
| 94 | + |
| 95 | +#### Returns |
| 96 | +int The current threshold value. |
| 97 | +<hr /> |
| 98 | + |
0 commit comments