//CASTRO, AUBREY A.
//NW-301
//SHWINT - Mid Individual Assignment 2
//Controlling the Potentiometer to change the corresponding LED brightness that shows the value in the Serial Monitor
void setup() {
Serial.begin(9600);
pinMode(9, OUTPUT);
}
void loop() {
int potValue = analogRead(A0);
int brightness = potValue / 4;
static int lastBrightness = -1;
if (abs(brightness - lastBrightness) > 2) {
analogWrite(9, brightness);
Serial.print("LED Brightness: ");
Serial.println(brightness);
lastBrightness = brightness;
}
delay(500);
}