// Activity 4:LED with Potentiometer
const int LED_PIN = 9; // Pin for the LED
const int POT_PIN = A4; // Pin for the Potentiometer
void setup() {
// Initialize the LED pin as an output
pinMode(LED_PIN, OUTPUT);
}
void loop() {
// Read the value from the potentiometer
int potentiometerValue = analogRead(POT_PIN);
// Map the potentiometer value (0-1023) to the LED brightness (0-255)
int brightness = map(potentiometerValue, 0, 1023, 0, 255);
// Set the brightness of the LED
digitalWrite(LED_PIN, brightness);
// Small delay for stability and to avoid overwhelming the serial monitor
delay(10); // Adjust delay time as needed
}