Created
September 6, 2013 17:09
-
-
Save arielchuri/6466736 to your computer and use it in GitHub Desktop.
CapSense Test Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CapSense Test Code | |
#include <CapacitiveSensor.h> | |
CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2); // 10 megohm resistor between pins 4 & 2, pin 2 is sensor pin, add wire, foil | |
void setup() | |
{ | |
cs_4_2.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_4_2.capacitiveSensor(30); | |
Serial.print(millis() - start); // check on performance in milliseconds | |
Serial.print("\t"); // tab character for debug windown spacing | |
Serial.println(total1); // print sensor output 1 | |
delay(10); // arbitrary delay to limit data to serial port | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment