Reseting analogRead()

Hello
I am making a noise detector project.
I take 30 samples of sound (from Sparkfun Soundetector) and make an average of them.
Then i convert them do dBs and then depending on the noise I have 3 comparators.

  1. quiet ( green led on, displaying the value at the lcd )
  2. medium ( yellow led on, displaying the value at the lcd)
  3. loud ( red led on, displaying the value at the lcd) + an audio information" Please be quiet" from wtv020sd mp3 player. And the problem is that when it’s loud and the audio information turns on the speaker makes noise by itself and it goes to some kind of loop or it takes some time after the average goes down below the " loud " level. So the sound"Please be quiet" is going on and on in a loop because from the program it gets the info that it’s still loud.
    Is there some way I can RESET the value from the sensor so when it’s loud the sound comes on, the led and the lcd and just after if finishes it starts taking NEW 30 samples .

Just don't take samples while the audible message is being played. Start taking samples again when the message is complete.

Post your code for more help

Yeah that's what I am asking for. I know it may sound stupid but HOW can I STOP taking samples and START taking samples again?

Zawislak:
Yeah that’s what I am asking for. I know it may sound stupid but HOW can I STOP taking samples and START taking samples again?

By not calling analogRead.

The structure of my program look like this
in void loop:

  1. take samples and make an avergae
  2. calculate dBs
  3. if value in dBs >40 …quiet
    if valuse >40 & < 70 … medium
    else if value >60 &< 110 loud
    So how can i STOP analogread because it’s in the loop

UKHeliBob:
Post your code for more help

here's the code:

Because of the school, I can not paste the code so I add the screenshot.

No,

post it in code tags so we can see it inline and its copy/pastable

Zawislak:
here's the code:

Screenshot-1 — ImgBB

Because of the school, I can not paste the code so I add the screenshot.

It will be nearly impossible to give you any more specific help without the code. If the school doesn’t want you to share the code then it is probably because they expect you to figure this out yourself.

You need some if statements. If your sound is not on then read your sound level. Else don’t.