// test1: gradual change in brightness
int sensorPin = A0;
int sensorReading = 0;
int ledPin = D1;
int ledBrightness = 0;
void setup() {
pinMode(ledPin, OUTPUT);
Particle.variable("Flexure", &sensorReading, INT);
Particle.variable("Brightness", &ledBrightness, INT);
}
void loop()
{
sensorReading = analogRead(sensorPin);
ledBrightness = map(sensorReading, 3350, 4095, 255, 0);
analogWrite(ledPin, ledBrightness);
delay(100);
}
Click to Expand
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. .