Back to Parent

int BendPin = A3;
int BendReading = 0;
int ledPin = D2;
int ledBrightness = 0;
    
void setup() {
    pinMode(ledPin , OUTPUT);
    Particle.variable("resistance", &BendReading, INT);
    Particle.variable("brightness", &ledBrightness, INT);
}

void loop() {
    BendReading = analogRead(BendPin);
    ledBrightness = map(BendReading, 500, 1500, 0, 255);
    analogWrite(ledPin, ledBrightness);
    //delay(500);
}
Click to Expand

Content Rating

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

0