Distance Detector Code Error

Hi,

I’m trying to build a distance sensor with the ultrasonic sensor and a piezo buzzer, and I’m using a TM1637 4-digit display to show the distance (in cm). I coded it so if the sensor senses something 5 cm away, it make the buzzer turn on. But for some reason when I send the code to my Arduino Uno, the buzzer just buzzes non stop. Here is my code:

#include <TM1637.h>

const int trigPin = 9;
const int echoPin = 10;

const int CLK = 2;
const int DIO = 3;
TM1637 tm1637(CLK, DIO);

long duration;
int distance;

const int piezo = 8;

boolean piezoMode = false;

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
tm1637.init();
tm1637.set(BRIGHT_TYPICAL);
delay(1500);
pinMode(piezo, OUTPUT);
}

void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;

Serial.println(distance);

int digitOne = distance / 10;
int digitTwo = distance % 10;

tm1637.display(1, digitOne);
tm1637.display(2, digitTwo);
tm1637.display(3, 12);

if ((distance) == 5) {
piezoMode = true;
}

if ((distance) != 5) {
piezoMode = false;
}

if ((piezoMode = true)) {
tone(piezo, 2000);
}

if ((piezoMode = false)) {
tone(piezo, 0);
}
}

Can someone pls help see if something is wrong?

if ((piezoMode = true)) {

= is assignment. == is comparison.