PA 10 00 Control zumbador potenciómetro.
// Definir pines
const int potPin = A0; // Pin del potenciómetro
const int buzzerPin = 9; // Pin del buzzer
void setup() {
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int potValue = analogRead(potPin); // Leer el valor del potenciómetro (0-1023)
int frequency = map(potValue, 0, 1023, 400, 2000); // Convertir a frecuencia
tone(buzzerPin, frequency);
Serial.println(potPin);
Serial.println(frequency);
delay(10);
}