Skip to main content
Tweeted twitter.com/#!/StackArduino/status/619786402755145728
ported the edit from the original StackOverflow Question http://stackoverflow.com/questions/29320473/arduino-uno-capacitive-sensor-not-working
Source Link

I use this: https://copy.com/thumbs_public/brrTUR3NBIZp/2.+DIY+Piano/2.+DIY+Piano+%28Breadboard%29.png?size=1024 I haveThis is a problem readingvisualization of my Arduino connections:

enter image description here

I wish to read the data. Do not get anything. How to wire touch it nothing happens, I do not know what is wrong using the Capacitive sensor Library. Variables total1 iv'e tried the following code but variables total1, total2total2, total3total3 always have the value 00 and i don't know what is wrong. My code

My code:

I use this: https://copy.com/thumbs_public/brrTUR3NBIZp/2.+DIY+Piano/2.+DIY+Piano+%28Breadboard%29.png?size=1024 I have a problem reading the data. Do not get anything. How to wire touch it nothing happens, I do not know what is wrong. Variables total1, total2, total3 always have the value 0. My code

This is a visualization of my Arduino connections:

enter image description here

I wish to read the data using the Capacitive sensor Library. iv'e tried the following code but variables total1, total2, total3 always have the value 0 and i don't know what is wrong.

My code:

Source Link
lukassz
  • 143
  • 1
  • 4

Arduino UNO capacitive sensor not working

I use this: https://copy.com/thumbs_public/brrTUR3NBIZp/2.+DIY+Piano/2.+DIY+Piano+%28Breadboard%29.png?size=1024 I have a problem reading the data. Do not get anything. How to wire touch it nothing happens, I do not know what is wrong. Variables total1, total2, total3 always have the value 0. My code

// 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");
}