CapSense Serial Monitor same value

Hi everyone,

I'm a newbie using arduino but I tried something with the CapSense.

It worked just fine (the numbers in the Serial Monitor changed a bit while contacting with my finger), but now I get always the same number in the Serial Monitor :x Does that mean the resistor is dead or something?

I already checked the circuit and it seems ok.

Any tip is welcomed.

Thanks in advance.

Try this

Hi AWOL,

I already did ^^ Here is my simple code so far:

#include <CapSense.h>

CapSense   cs_4_2 = CapSense(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired

int inByte = 0;         // incoming serial byte

void setup()                    
{
  cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
  Serial.begin(9600); // start serial port at 9600 bps:
}

void loop()                    
{

  long start = millis();
  long total1 =  cs_4_2.capSense(30);
  

  if(total1 > 300)
  {
    Serial.println('total1'); //when there is contact
  }
  else
  {
    Serial.print('B'); //when there is no contact
  }

  delay(100);   // arbitrary delay to limit data to serial port 
}
Serial.println('total1');

It is legal, but it isn't a string. Try double quotes.

Thanks AWOL, I tried that and it doesn't work :x

I'll start from scratch, let's see if I find the solution.

If I get somewhere I'll post here :)

Does that mean the resistor is dead or something?

Seems unlikely - very hard to kill a resistor in this sort of application.

That's exactly what I wanted to know in first place, now I'm sure it's something on the process ^^

Thank u a lot AWOL!

Already scratching.

Hope to share news soon.

Serial.println('total1');

It is legal, but it isn't a string. Try double quotes.

Looks to me like you want to loose the quotes altogether. If you are trying to print the value in the variable, that is, rather than the name of the variable. I'd think the value more useful than the name.

You're right PaulS ^^

That's why I used Serial.println(total1); and I already see the values like I saw before - changing.