SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <CapacitiveSensor.h>
  2.  
  3. /*
  4.  * CapitiveSense Library Demo Sketch
  5.  * Paul Badger 2008
  6.  * Uses a high value resistor e.g. 10M between send pin and receive pin
  7.  * Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.
  8.  * Receive pin is the sensor pin - try different amounts of foil/metal on this pin
  9.  */
  10.  
  11.  
  12. CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
  13.  
  14. void setup()                    
  15. {
  16.    Serial.begin(9600);
  17. }
  18.  
  19. void loop()                    
  20. {
  21.     Serial.println(cs_4_2.capacitiveSensor(30));
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top