int potPin = A5;
int potRead = 0;
int ledPin = D2;
int ledBright = 0;
void setup() {
pinMode(ledPin, OUTPUT);
Particle.variable("pot", potRead);
}
void loop() {
potRead = analogRead(potPin);
// change the range of potRead
ledBright = map(potRead, 0, 4095, 0, 255);
analogWrite(ledPin, ledBright);
}
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. .