Back to Parent

int ledPin = D7;
 
void setup() {
    pinMode(ledPin, OUTPUT);
}
 
void loop() {
    int analogvalue = analogRead(A0);
    if(analogvalue > 0) {
        Particle.publish("toggle-led-bat", PRIVATE);
        digitalWrite(ledPin, HIGH);   // Turn ON the LED pins
        
    } else {
        digitalWrite(ledPin, LOW);   // Turn OFF the LED pins
    }
    delay(1000);               // Wait for 1000mS = 1 second
}
Click to Expand

Content Rating

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

0