// PWM pins are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
#include <Arduino.h>
const int ledPin = 11;
int brightness = 0;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int darkness = analogRead(A0);
if (darkness > 900) {
brightness = 255;
} else if (darkness > 700) {
brightness = 180;
} else if (darkness > 500) {
brightness = 100;
} else {
brightness = 0;
}
analogWrite(ledPin, brightness);
delay(1000);
}