Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement