Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By taichi729
#40606 Hi im working with iot and i want to use capacitive sensor but when i use it its display unknown thing on serial monitor Someone PLZ help!!!
THIS IS CODE.
Code: Select all#include <CapacitiveSensor.h>
CapacitiveSensor   cs_7_4 = CapacitiveSensor(D7,D4);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
CapacitiveSensor   cs_7_3 = CapacitiveSensor(D7,D3);        // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil
CapacitiveSensor   cs_7_2 = CapacitiveSensor(D7,D2);        // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil

void setup()                   
{
   cs_7_4.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_7_4.capacitiveSensor(30);
    long total2 =  cs_7_3.capacitiveSensor(30);
    long total3 =  cs_7_2.capacitiveSensor(30);

    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");
    Serial.print(total2);                  // print sensor output 2
    Serial.print("\t");
    Serial.println(total3);                // print sensor output 3

    delay(10);                             // arbitrary delay to limit data to serial port
}

AND THIS IS OUT PUT.
Image