int buzzerpin = 12;

void setup() {
  // put your setup code here, to run once:
pinMode(buzzerpin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
int value = analogRead(A0);
digitalWrite(buzzerpin, HIGH);
tone(buzzerpin, value);
delay(value);
digitalWrite(buzzerpin, LOW);
delay(value);
Serial.println(value);
}