const int ledPin = 10;
const int ledPin2 = 11;
const int buzzerPin = 9;
// Analog pin where the potentiometer is connected
const int potPin =A0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600); // Start serial communication
}
void loop() {
// Read the potentiometer value
int potValue = analogRead(potPin);
// Map the potentionmeter value to 0-255
int ledBrightness = map(potValue, 0, 1023, 0, 255);
int buzzerFrequency = map(potValue, 0, 1023, 100, 1000);
// Set the LED brightness
analogWrite(ledPin, ledBrightness);
analogWrite(ledPin2, 255 - ledBrightness);
tone(buzzerPin, buzzerFrequency);
Serial.print("Potentiometer Value: ");
Serial.print(potValue);
Serial.print("LED Brightness: ");
Serial.print(ledBrightness);
Serial.print(" | Buzzer Frequency: ");
Serial.println(buzzerFrequency);
delay(1000);
}