Arduino Function: Capacitive.CapacitiveSensor


capacitiveSensor requires one parameter, samples, and returns a long int containing the added (sensed) capacitance, in arbitrary units. capacitiveSensor keeps track of the lowest baseline (unsensed) capacitance, and subtracts that from the sensed capacitance, so it should report a low value in the unsensed condition. 
The baseline is value is re-calibrated at intervals determined by CS_Autocal_Millis. The default value is 200000 milliseconds (20 seconds). This re-calibration may be turned off by setting CS_Autocal_Millis to a high value with the set_CS_AutocaL_Millis() method.


long capacitiveSensor(byte samples);


  • samples: byte


long the added (sensed) capacitance

Based on the reference originally written by Arduino Community, and