Petoi Doc Center

Touch Sensor

Function introduction

The sensor contains two touch parts (left and right) and can detect changes in capacitance when a finger approaches. This means that the touch sensor will output a high level whether your finger touches lightly or presses hard. You can realize the function you want by judging the detected value (1 for high level, 0 for low level).

Hardware setup

Connecting to the NyBoard with wire as shown in the following picture:
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.

Software setup

You can use the Arduino IDE to upload the demo code (doubleTouch.ino) or compile and upload your own code.
This demo sketch (doubleTouch.ino) implements real-time printing of the detection values of D6 and D7 pins in the serial monitor:

The demo code