int flexPin = A0;
int flexReading = 0;
int ledPin = D2;
int ledBrightness = 0;
void setup() {
pinMode(ledPin, OUTPUT);
Particle.variable("snoopy", flexReading );
}
void loop() {
flexReading = analogRead(flexPin);
ledBrightness = map(flexReading, 0, 4095, 0, 255);
analogWrite(ledPin, ledBrightness);
delay(100);
}
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .