#include <CapSense.h>

/*
* CapitiveSense Library Demo Sketch
* Paul Badger 2008
* Uses a high value resistor e.g. 10M between send pin and receive pin
* Receive pin is the sensor pin - try different amounts of foil/metal on this pin
* Also higher value resistors e.g. 40M
*/

CapSense cs_11_10 = CapSense(11,10); // 10M resistor between pins 11 & 10, pin 10 is sensor pin, add a wire and or foil if desired
CapSense cs_11_9 = CapSense(11,9); // 10M resistor between pins 11 & 9, pin 9 is sensor pin, add a wire and or foil
CapSense cs_11_8 = CapSense(11,8); // 10M resistor between pins 11 & 8, pin 8 is sensor pin, add a wire and or foil
CapSense cs_11_7 = CapSense(11,7); // 10M resistor between pins 11 & 7, pin 7 is sensor pin, add a wire and or foil
CapSense cs_11_6 = CapSense(11,7); // 10M resistor between pins 11 & 7, pin 7 is sensor pin, add a wire and or foil
CapSense cs_11_5 = CapSense(11,7); // 10M resistor between pins 11 & 7, pin 7 is sensor pin, add a wire and or foil
CapSense cs_11_4 = CapSense(11,7); // 10M resistor between pins 11 & 7, pin 7 is sensor pin, add a wire and or foil
CapSense cs_11_3 = CapSense(11,7); // 10M resistor between pins 11 & 7, pin 7 is sensor pin, add a wire and or foil
CapSense cs_11_2 = CapSense(11,7); // 10M resistor between pins 11 & 7, pin 7 is sensor pin, add a wire and or foil
CapSense cs_11_1 = CapSense(11,7); // 10M resistor between pins 11 & 7, pin 7 is sensor pin, add a wire and or foil

void setup()
{

cs_11_1.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_11_10.capSense(30);
long total2 = cs_11_9.capSense(30);
long total3 = cs_11_8.capSense(30);
long total4 = cs_11_7.capSense(30);
long total5 = cs_11_6.capSense(30);
long total6 = cs_11_5.capSense(30);
long total7 = cs_11_4.capSense(30);
long total8 = cs_11_3.capSense(30);
long total9 = cs_11_2.capSense(30);
long total10 = cs_11_1.capSense(30);

Serial.print(millis() - start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug windown spacing

Serial.print(total1); // print sensor output 1
Serial.print("\t");
Serial.print(total2); // print sensor output 2
Serial.print("\t");
Serial.print(total3); // print sensor output 3
Serial.print("\t");
Serial.print(total4); // print sensor output 4
Serial.print("\t");
Serial.print(total5); // print sensor output 5
Serial.print("\t");
Serial.print(total6); // print sensor output 6
Serial.print("\t");
Serial.print(total7); // print sensor output 7
Serial.print("\t");
Serial.print(total8); // print sensor output 8
Serial.print("\t");
Serial.print(total9); // print sensor output 9
Serial.print("\t");
Serial.println(total10); // print sensor output 10

delay(0); // arbitrary delay to limit data to serial port
}