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?
#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
}
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.