problem oled and buzzer

Hello. I did a project with an alcohol detector to go very good.And I met him a problem.Il want to add a buzzer to ring only if statement (value> = 200 && value <280), when appearing on LCD. display.println ( "You had a beer."); , and it does not work. I did something wrong in code?.Not using Tone library Any answer is welcome. I'm a beginner. This is the code. Thanks.

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
int TIME_UNTIL_WARMUP = 900;
unsigned long time;


int analogPin = 0;
int val = 0;
int buzzer = 10;
Adafruit_SSD1306 display(OLED_RESET);


void setup() { 

display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
pinMode(10,OUTPUT);
}


void loop() { 

delay(100);

val = readAlcohol();
printTitle();
printWarming();

time = millis()/1000;

if(time<=TIME_UNTIL_WARMUP)
{
time = map(time, 0, TIME_UNTIL_WARMUP, 0, 100);
display.drawRect(10, 50, 110, 10, WHITE); //Empty Bar
display.fillRect(10, 50, time,10,WHITE);
}else
{
printTitle();
printAlcohol(val);
printAlcoholLevel(val); 
}
display.display();

}


void printTitle()
{
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(22,0);
display.println("Breath Analyzer");
}

void printWarming()
{
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,20);
display.println("Warming up");
}

void printAlcohol(int value)
{
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(45,25);
display.println(val);
}

void printAlcoholLevel(int value)
{
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(10,55);

if(value<200)
{
display.println("You are sober.");
}
if (value>=200 && value<280)
{
display.println("You had a beer.");
digitalWrite(10,HIGH);
}
if (value>=280 && value<350)
{
display.println("Two or more beers.");
}
if (value>=350 && value <450)
{
display.println("I smell Oyzo!");
}
if(value>450)
{
display.println("You are drunk!");
digitalWrite(10,HIGH);
}
}

int readAlcohol()
{
int val = 0;
int val1;
int val2;
int val3; 


display.clearDisplay();
val1 = analogRead(analogPin); 
delay(10);
val2 = analogRead(analogPin); 
delay(10);
val3 = analogRead(analogPin);

val = (val1+val2+val3)/3;
return val;
}

What "buzzer" are you using, how have you connected it?

Some buzzers take a lot of current as they contain coils, some must be driven with a waveform.

I connected a wire in a pin 10 and a wire in GND and not work .Maybe I did not write correct code. Buzzer is 8 ohm / 0.25 Watt. Send attachment buzzer.

You have a speaker rather than a buzzer, this must be driven with a waveform.

The microprocessor in the Arduino, for example an UNO, is not designed to drive a speaker as it is a low impedance load and, because it contains coils and magnets, it generates kickback voltages that can damage a microprocessor. Thus strictly speaking (pun!) you should use an amplifier.

However, it is posible to use a digital pin if you add a series resistor of at least 100 Ohms.

You will also need to drive it with a waveform from the pin. You can do this with code (this is pseudo code here):

for x = 0 to 500 {
set pin low
delay of 2ms
set pin high
delay of 2ms }

The delay will determine the frequency of the tone. For higher frequencies use delayMicroseconds().

If you Google driving a loudspeaker with an arduino you should find out more.