Capacitive sensor for Arduino¶
Add a capacitive sensor to your Arduino and make your Arduino work as a keyboard.
Materials¶
- Arduino Uno or Leonardo (use a Leonardo if you want to use it as a keyboard on your laptop)
- Breadboard
- Jumpercables
- 1γ resistor
- Crocodile clip
- Something conductive (metal/aluminium foil/conductive paint/copper tape/β¦)
Hardware¶
Use the materials and circuit diagram to set up the hardware. The pins 2 and 12 are chosen random, but they should match the pins in your code. The yellow cable labeled βTOUCHβ can be connected with a crocodile clip to whatever conductive material you want to use.
Code¶
Start up the Arduino IDE and open the Library manager:
Search for the CapacitiveSensor library, hit install and restart the Arduino IDE.
Use the following code to make the built-in LED flash for a moment. The example code also has lines for two other capacitive sensors on pins 4 and 5.