If Else Problem

I’m working on a school project and I’m trying to reverse engineer a wireless doorbell. The following code results in the RF transmitter sending only 4 one bits instead of 4 sets of 150. When I take out the first ‘if’ it sends 4 sets of 150 like it should. Am I doing something wrong?

void ring_bell()
{
  // Our doorbell sends the code 4 times so we'll send the single ring 4 times
  for (int j = 0; j < 4; j++)
  {
    single_ring();
  
  }
}

void single_ring()
{
  // first, send the preample
  for (int i = 0; i < 150; i++)
  {
    digitalWrite(TX_PIN, HIGH);
    delayMicroseconds(150);
    digitalWrite(TX_PIN, LOW);

    // if the last bit has been transmitted, then delay longer before the real data starts
    if (i = 149)
    {
      delayMicroseconds(24102);
    }
    else
    {
       delayMicroseconds(980);
    }
  }
}

    if (i = 149)= or == ?

I feel really dumb......

I haven't written a program in over a year so I'm pretty rusty.

Thank you!!!!!

I feel really dumb......

Don't be too hard on yourself, we have all done it.