Hi! I am having trouble making CapacitiveSensorDue library works on DUE.
Here is my code
#include <CapacitiveSensorDue.h>
/*
* CapitiveSense Library Demo Sketch
* Paul Badger 2008
* Uses a high value resistor e.g. 10M between send pin and receive pin
* Resistor effects sensitivity, experiment with values, 50K - 50M. Larger
* resistor values yield larger sensor values.
* Receive pin is the sensor pin - try different amounts of foil/metal on this
* pin.
*/
CapacitiveSensorDue cs_4_2 = CapacitiveSensorDue(4,2); // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
void setup()
{
Serial.begin(9600);
}
void loop()
{
long total1 = cs_4_2.read(30);
Serial.println(total1); // print sensor output 1
delay(50); // arbitrary delay to limit data to serial port
}
Everytime total1 equals to -1 and I don’t know why.
Actually I tried different resistor values between 1M and 8.6M but it doesn’t change nothing.
I attached to this post the circuit sketch