Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Import the CapacitiveSensor Library.
- #include <CapacitiveSensor.h>
- // Name the pin as led.
- #define speaker 11
- // Set the Send Pin & Receive Pin.
- CapacitiveSensor cs_2_3 = CapacitiveSensor(2,3); // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
- CapacitiveSensor cs_2_4 = CapacitiveSensor(2,4); // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil
- CapacitiveSensor cs_2_5 = CapacitiveSensor(2,5); // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
- CapacitiveSensor cs_2_6 = CapacitiveSensor(2,6); // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
- CapacitiveSensor cs_2_7 = CapacitiveSensor(2,7); // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
- CapacitiveSensor cs_2_8 = CapacitiveSensor(2,8); // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
- CapacitiveSensor cs_2_9 = CapacitiveSensor(2,9); // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
- void setup()
- {
- cs_2_3.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
- // Arduino start communicate with computer.
- Serial.begin(9600);
- }
- void loop()
- {
- // Set a timer.
- long start = millis();
- // Set the sensitivity of the sensors.
- long total1 = cs_2_3.capacitiveSensor(60);
- long total2 = cs_2_4.capacitiveSensor(60);
- long total3 = cs_2_5.capacitiveSensor(60);
- /* long total4 = cs_2_6.capacitiveSensor(60);
- long total5 = cs_2_7.capacitiveSensor(60);
- long total6 = cs_2_8.capacitiveSensor(60);
- long total7 = cs_2_9.capacitiveSensor(60);*/
- Serial.print(millis() - start); // check on performance in milliseconds
- Serial.print("t"); // tab character for debug windown spacing
- Serial.print(total1); // print sensor output 1
- Serial.print("t"); // Leave some space before print the next output
- Serial.print(total2); // print sensor output 2
- Serial.print("t"); // Leave some space before print the next output
- Serial.print(total3); // print sensor output 3
- Serial.print("t"); // Leave some space before print the next output
- Serial.print("n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement