Problem with mic , preamplified

Dear All,
This Script is not completed, but I have a big problem since the value that I read on the pin A3 continue increasing over time.
(A3 is linked to a Preamplified Microphone).
On the contrary, if i Run a very simple script like the one below, the value does not increase.
Why?

Thank You
Marcello

STUPID SCRIPT (does not increase)

(void setup() {
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
int lettura = analogRead(A3);
Serial.println(lettura, DEC);
}

MY SCRIPT (INCREASE)

#define buttonPin 10
#define ledPin 13
#define MicPin 11
#define FlashPin 12
#define ThresholdPin 8
#define SWITCH_PIN A2
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2); // set LCD
int previousState;

int val=0; //Stato del PIN
int old_val=0;
int buttonState= 0;
int micstate=0;
int soglia=1024;
int ThresholdPinState=HIGH;
float fdrange=0;

void setup() {

lcd.init(); // initialize the lcd

Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
pinMode(FlashPin,OUTPUT);
pinMode(ThresholdPin,INPUT);
previousState = 0;
}

void loop() {
while (ThresholdPinState == HIGH) {
ThresholdPinState=digitalRead(ThresholdPin);
soglia=analogRead(A0);
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Soglia = ");
lcd.print(soglia);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(" ");
}
ThresholdPinState=digitalRead(ThresholdPin);
float sensorValue1 = analogRead(A0);
float sensorValue2 = analogRead(A1);
int micread = analogRead(A3);
float DelayFlash;
Serial.println(micread, DEC);

// switch range tempi 0-5 0-50 0-1000

int analogValue = analogRead(SWITCH_PIN);
int actualState;
if(analogValue < 100) actualState = 1;
else if(analogValue < 900) actualState = 3;
else actualState = 2;

if(previousState != actualState) {

previousState = actualState;
if (actualState == 1) fdrange = 204.60;
if (actualState == 2) fdrange = 20.46;
if (actualState == 3) fdrange = 1.023;

}

// Lettura Potenziometri per regolazione Delay

sensorValue1 = 1023 - sensorValue1;
sensorValue2 = 1023 - sensorValue2;
sensorValue1 = sensorValue1/fdrange;
sensorValue2 = sensorValue2/fdrange;
sensorValue2 = sensorValue2/10;

DelayFlash = sensorValue2 + sensorValue1;
val = digitalRead(buttonPin);
digitalWrite(FlashPin, LOW);

// Print Delay on LCD

lcd.setCursor(0,1);
lcd.print("Ritardo = ");
lcd.print(DelayFlash,2);
lcd.print(" ");

//Controlla se il Bottone รจ stato premuto

if ((val == HIGH) && (old_val == LOW)) {
buttonState = 1 - buttonState;
delay(50);
}

old_val = val;

if (buttonState == 1) {

// Countdown and Flash
lcd.clear();
lcd.setCursor(0,0);
lcd.print("COUNTDOWN");
digitalWrite(ledPin, HIGH);
lcd.setCursor(0,1);
lcd.print("5 secondi");
delay (1000);
lcd.setCursor(0,1);
lcd.print("4 secondi");
delay (1000);
lcd.setCursor(0,1);
lcd.print("3 secondi");
delay (1000);
lcd.setCursor(0,1);
lcd.print("2 secondi");
delay (1000);
lcd.setCursor(0,1);
lcd.print("1 secondi");
delay (1000);
lcd.setCursor(0,1);
lcd.print("TRIGGER PRONTO!!");

while (micstate <= soglia) {
micstate=analogRead(A3);
}

delay (DelayFlash);
digitalWrite(FlashPin, HIGH);
digitalWrite(ledPin, LOW);
lcd.clear();
micstate = 0;
buttonState = 0;

}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}

Read the how to use this forum sticky then go an put code tags round that code.
( The </> icon )

Have you connected the ground of your amplifier to the ground of your Arduino?
Have you AC coupled your amplifier?
Have you biased the input pin?

Hi Mike,

Have you connected the ground of your amplifier to the ground of your Arduino?

*yes

Have you AC coupled your amplifier?

*yes

Have you biased the input pin?

*could you explain my what you mean for (biased the input pin).

Maybe I have found a solution but I'm not sure if it is the right one.
I have put one 50K resistor in parallel between micOUT and GND.
Value that A3 read now i stable and near to 0 with silence.

What do you think about this solution?

Many thanks

Marcello

What do you think about this solution?

Sorry but not a lot.

Value that A3 read now i stable and near to 0 with silence.

It should be 512 with silence. An audio signal will go either side of zero, so biasing makes the signal 2.5V with nothing out.
Connect another 50K (50K? are you sure ) from A3 to +5V.