Skip to content

Commit f108b33

Browse files
Apply suggestions from code review
Co-authored-by: TaddyHC <[email protected]>
1 parent e5ad416 commit f108b33

File tree

1 file changed

+21
-24
lines changed
  • content/hardware/02.hero/boards/uno-r4-wifi/tutorials/touch

1 file changed

+21
-24
lines changed

content/hardware/02.hero/boards/uno-r4-wifi/tutorials/touch/content.md

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Uno R4 Capacitor Tutorial
2+
title: Uno R4 Capacitive-Touch Tutorial.
33
description: Learn to use the built-in capacitive sensing capabilities of the Arduino® Uno R4.
44
tags: [Arduino, Capacitive Sensing, Uno R4]
55
author: Pedro Lima
@@ -19,17 +19,16 @@ Here's the process:
1919
3. This changes the capacitance of the system
2020
4. The microcontroller measures this change and determines if it's significant enough to register as a "touch"
2121

22-
23-
2422
## Using Capacitive Sensing on the Uno R4
2523

2624
The Uno R4 features a Capacitive Touch Sensing Unit (CTSU) that allows you to use certain pins as capacitive touch inputs. To utilize these capabilities, you can use the [Arduino_CapacitiveTouch library](https://github.com/arduino-libraries/Arduino_CapacitiveTouch).
2725

2826
### Compatible Pins
2927

30-
For both the Uno R4 WiFi and Minima, the compatible pins for capacitive touch are listed in the [Arduino_CapacitiveTouch library documentation](https://github.com/arduino-libraries/Arduino_CapacitiveTouch?tab=readme-ov-file#compatible-pins).
28+
For both the Uno R4 WiFi and Minima boards, the compatible pins for capacitive touch are listed in the [Arduino_CapacitiveTouch library documentation](https://github.com/arduino-libraries/Arduino_CapacitiveTouch?tab=readme-ov-file#compatible-pins).
3129

3230
**Arduino® UNO-R4 Minima:**
31+
3332
| Arduino Pin | Touch Sensor Channel (TS#) | Channel Control Index (CHAC idx) | Channel Control Bit Mask (CHAC val) |
3433
|--------------|----------------------------|----------------------------------|-------------------------------------|
3534
| D0 | 9 | 1 | (1 << 1) |
@@ -45,6 +44,7 @@ For both the Uno R4 WiFi and Minima, the compatible pins for capacitive touch ar
4544
| LOVE_BUTTON | 0 | 0 | (1 << 0) |
4645

4746
**Arduino® UNO-R4 WiFi:**
47+
4848
| Arduino Pin | Touch Sensor Channel (TS#) | Channel Control Index (CHAC idx) | Channel Control Bit Mask (CHAC val) |
4949
|--------------|----------------------------|----------------------------------|-------------------------------------|
5050
| D0 | 9 | 1 | (1 << 1) |
@@ -63,29 +63,26 @@ For both the Uno R4 WiFi and Minima, the compatible pins for capacitive touch ar
6363

6464
### Library Functions
6565

66-
The Arduino_CapacitiveTouch library provides several functions to work with capacitive touch inputs:
66+
The **Arduino_CapacitiveTouch** library provides several functions to work with capacitive touch inputs:
6767

68-
- **```CapacitiveTouch(uint8_t pin)```** Constructs a capacitive touch sensor for the given pin.
69-
- **```bool begin()```** Initializes the sensor and configures the pin and hardware.
70-
- **```int read()```** Reads the raw sensor value and returns it.
71-
- **```bool isTouched()```** Checks if the sensor is touched based on the threshold.
72-
- **```void setThreshold(int threshold)```** Sets the detection threshold for touch sensitivity.
73-
- **```int getThreshold()```** Retrieves the current detection threshold.
68+
- **`CapacitiveTouch(uint8_t pin)`** Constructs a capacitive touch sensor for the given pin.
69+
- **`bool begin()`** Initializes the sensor and configures the pin and hardware.
70+
- **`int read()`** Reads the raw sensor value and returns it.
71+
- **`bool isTouched()`** Checks if the sensor is touched based on the threshold.
72+
- **`void setThreshold(int threshold)`** Sets the detection threshold for touch sensitivity.
73+
- **`int getThreshold()`** Retrieves the current detection threshold.
7474

7575
For more detailed usage and examples, refer to the [CapacitiveSensor library documentation](https://docs.arduino.cc/libraries/capacitivesensor/).
7676

7777
## Example Code
7878

79-
Here's a simple example to get you started with capacitive sensing on the Uno R4.
80-
For this example we are connecting a single piece of any conductive material to the pin ```D0``` on the Board.
79+
Here's a simple example to get you started with capacitive sensing on the Uno R4. For this example, we are connecting a single piece of any conductive material to the pin `D0` on the Board.
8180

8281
![How to connect](assets/HoockupGuideExample.png)
8382

84-
**Note:**
85-
You will first need to install the library [Arduino_CapacitiveTouch](https://docs.arduino.cc/libraries/capacitivesensor/):
86-
```Arduino IDE: Library Manager → Search "Arduino_CapacitiveTouch" → Install```
83+
***__Note:__ You will first need to install the library [Arduino_CapacitiveTouch](https://docs.arduino.cc/libraries/capacitivesensor/). To do so, open `Arduino IDE: Library Manager``Search "Arduino_CapacitiveTouch"` within _Manage Libraries_ option → `Install` .***
8784

88-
```ARDUINO
85+
```arduino
8986
#include "Arduino_CapacitiveTouch.h"
9087
9188
CapacitiveTouch touchButton = CapacitiveTouch(D0);
@@ -117,14 +114,14 @@ void loop() {
117114
```
118115

119116
## Creative Project Ideas
120-
Now that you understand the basics, here are some project ideas:
121117

122-
**Touch-Controlled Night Light -** Create a lamp that turns on/off with a touch
123-
**Capacitive Touch Piano -** Use multiple pins to create touch-sensitive keys
124-
**Smart Home Controller -** Touch different areas to control various devices
125-
**Interactive Art Installation -** Create touch-responsive visual or audio effects
118+
Now that you have learned the basics, here are some fun and interesting project ideas:
119+
120+
- **Touch-Controlled Night Light -** Create a lamp that turns on/off with a touch
121+
- **Capacitive Touch Piano -** Use multiple pins to create touch-sensitive keys
122+
- **Smart Home Controller -** Touch different areas to control various devices
123+
- **Interactive Art Installation -** Create touch-responsive visual or audio effects
126124

127125
## Conclusion
128126

129-
The built-in capacitive sensing capabilities of the Arduino® Uno R4 provide an excellent way to add touch inputs to your projects. By leveraging the Arduino_CapacitiveTouch library, you can easily integrate touch-sensitive features, enhancing the interactivity and functionality of your designs. Whether you're building a simple touch interface or a more complex interactive system, the Uno R4's capacitive sensing features offer a versatile and user-friendly solution.
130-
Remember to experiment with threshold values and consider the environment where your project will be used, as factors like humidity and nearby electronics can affect sensitivity. With practice, you'll develop an intuitive understanding of how to tune these sensors for optimal performance in your specific applications.
127+
Capacitive sensing on the Arduino UNO R4 lets you add intuitive touch controls with minimal hardware, simply pair the board with the `Arduino_CapacitiveTouch` library. Tune the detection threshold for your environment (humidity, nearby electronics, etc.), and you can quickly scale from a single touch button to richer, multi-point interfaces.

0 commit comments

Comments
 (0)