error compiling for board arduino leonardo

hello everyone

i really want to make a capacitive sensor keypad like the one SquashyBoy made in his video.

but, because i’m literally a newbie on programming arduino, i don’t know what to do to fix this error

the error:

C:\Users\zakit\AppData\Local\Temp\ccLCueWf.ltrans0.ltrans.o: In function `CapacitiveKey::keyUpdate(bool)’:

C:\Users\zakit\AppData\Local\Temp\arduino_build_148351\sketch/capacitiveKey.h:23: undefined reference to `CapacitiveSensor::capacitiveSensorRaw(unsigned char)’

C:\Users\zakit\AppData\Local\Temp\ccLCueWf.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_KappaPad.ino.cpp.o.2177’:

:(.text.startup+0x136): undefined reference to `CapacitiveSensor::CapacitiveSensor(unsigned char, unsigned char)’

:(.text.startup+0x17c): undefined reference to `CapacitiveSensor::CapacitiveSensor(unsigned char, unsigned char)’

collect2.exe: error: ld returned 1 exit status

Using library Keyboard at version 1.0.2 in folder: C:\Program Files (x86)\Arduino\libraries\Keyboard

Using library HID at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\HID

exit status 1

Error compiling for board Arduino Leonardo.

Please post your full code. Before doing so, please read https://forum.arduino.cc/index.php?topic=148850.0 and pay special attention to point #7 about posting code using code tags.

Please post a link to the CapacitiveSensor library that you're using.

Most probably your CapacitiveSensor library (which exactly?) does not support the Leonardo.

Find a different library that is applicable to the Leonardo.

It looks like all of the errors are in the linker... the stage of the build where the various compiled binary files are linked together into a program. I suspect that one ort more source files are missing from the CapacitiveSensor library. Did you copy a CapacitiveSensor.h without the CapacitiveSensor.cpp file?

sterretje:
Please post your full code. Before doing so, please read https://forum.arduino.cc/index.php?topic=148850.0 and pay special attention to point #7 about posting code using code tags.

Please post a link to the CapacitiveSensor library that you’re using.

#include “CapacitiveSensor.h”
#include <Keyboard.h>

#include “capacitiveKey.h”

//#define SERIAL_OUTPUT
#define DISABLE_PIN 15

void setup() {
#ifdef SERIAL_OUTPUT
Serial.begin(115200);
#endif
Keyboard.begin();
pinMode(DISABLE_PIN, INPUT_PULLUP);
}

CapacitiveKey key0 = CapacitiveKey(
2, //Capacitive Send Pin
7, //Capacitive Sense Pin
6, //LED Pin
6, //Capacitive Treshold
‘z’, //Keyboard Key
255 //LED Brightness (0-255)
);
CapacitiveKey key1 = CapacitiveKey(
4, //Capacitive Send Pin
8, //Capacitive Sense Pin
10, //LED Pin
5, //Capacitive Treshold
‘x’, //Keyboard Key
255 //LED Brightness (0-255)
);

void loop() {
bool keyboardActive = digitalRead(DISABLE_PIN);
key0.keyUpdate(keyboardActive);
key1.keyUpdate(keyboardActive);

#ifdef SERIAL_OUTPUT
Serial.print(key0.sample);
Serial.print(",");
Serial.println(key1.sample);
#endif
}

here is the link: https://github.com/fb39ca4/kappa-pad

You did NOT read the link that I gave you :frowning:

You missed an important part in https://github.com/fb39ca4/kappa-pad:

Software

The Arduino Sketch is located in the KappaPad directory of this repository. It requires the CapacitiveSensor library so install that first.