Hey,
I wanted to use a Capacitive Sensor like in the example:
http://playground.arduino.cc//Main/CapacitiveSensor?from=Main.CapSense
Cause all of my digital pins except D2 are all being used, I deceided to use A0-A2 as receive pins and D2 as send pin . It doesn't work. As I can see the library uses only digital pins. So, my question is, what can I do if I want to use analog Pins
#include <CapacitiveSensor.h>
CapacitiveSensor cs_2_0 = CapacitiveSensor(2,0); // 10 megohm resistor between pins 4 & 2, pin 2 is sensor pin, add wire, foil
CapacitiveSensor cs_2_1 = CapacitiveSensor(2,1); // 10 megohm resistor between pins 4 & 6, pin 6 is sensor pin, add wire, foil
CapacitiveSensor cs_2_2 = CapacitiveSensor(2,2); // 10 megohm resistor between pins 4 & 8, pin 8 is sensor pin, add wire, foil
void setup()
{
cs_2_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
Serial.begin(9600);
}
void loop()
{
long start = millis();
long total1 = cs_2_0.capacitiveSensor(30);
long total2 = cs_2_1.capacitiveSensor(30);
long total3 = cs_2_2.capacitiveSensor(30);
Serial.print(millis() - start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug window spacing
Serial.print(total1); // print sensor output 1
Serial.print("\t");
Serial.print(total2); // print sensor output 2
Serial.print("\t");
Serial.println(total3); // print sensor output 3
delay(10); // arbitrary delay to limit data to serial port
}