Back to Parent

int buttonPin = D3;
int capPin = D4;
bool ananas = false; //

void setup() {
    
    pinMode(capPin, INPUT);
    pinMode(buttonPin, INPUT);
    Particle.variable("bool", ananas);
}

void loop() {

    if (digitalRead(capPin) == LOW)
    {
        ananas= !ananas;
        Particle.publish ("Capacitive Touch", "LOW");
        delay(2000);

    } else 
    {
        Particle.publish ("Capacitive Touch", "HIGH");
        delay(2000);
    }

}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0