This code example will utilive 4 capacitive inputs on A0 - A3.
Results for amalog values will be displayed int he serial monitor.
#include <ADCTouch.h>
int ref0, ref1, ref2, ref3; //reference values to remove offset
void setup() { // No pins to setup, pins can still be used regularly, although it will affect readings
Serial.begin(9600);
ref0 = ADCTouch.read(A0, 500); //create reference values to ref1 = ADCTouch.read(A1, 500); //account for the capacitance of the pad ref2 = ADCTouch.read(A2, 500); //create reference values to ref3 = ADCTouch.read(A3, 500); //account for the capacitance of the pad }
void loop() { int value0 = ADCTouch.read(A0); //no second parameter int value1 = ADCTouch.read(A1); // --> 100 samples int value2 = ADCTouch.read(A2); //no second parameter int value3 = ADCTouch.read(A3); // --> 100 samples