Robot Programming Question

I am programming a simple robot to go when a button is pressed, and to stop if it isn’t. I am using a nunchuck as the button. The code is pretty self explanatory; the digitalWrite commands set the direction of the motor to forward, and the analogWrite commands set the power of the motor. When I upload the code, the motors run at full speed, even if the if statement isn’t true. I have no idea what’s going on here! Any ideas?

int y;
int x = 0;
int b;

#include <Wire.h>
#include "nunchuck_funcs.h"


void setup()
{
    Serial.begin(19200);
    nunchuck_setpowerpins();
    nunchuck_init(); 
    pinMode(3, OUTPUT);  //Set control pins to be outputs
    pinMode(11, OUTPUT);
    pinMode(12, OUTPUT);
    pinMode(13, OUTPUT);
}

void loop()
{
        b = 0;
        nunchuck_get_data();
        b = nunchuck_zbutton();
        Serial.println(b);
        
        if (b = 1) {
          digitalWrite(12, HIGH);
          digitalWrite(13,HIGH);
          analogWrite(3, 255);  //set both motors to run at 100% duty cycle (fast)
          analogWrite(11, 255);
        }
        if (b = 0) {
          digitalWrite(12, HIGH);
          digitalWrite(13,HIGH);
          analogWrite(3, 0);  //set both motors to run at 100% duty cycle (fast)
          analogWrite(11, 0);
        }
        else {
        }
        
}

b = 1 is always true.
Try == for comparisons

Also, b= 0 is always false, try "else" when you've fixed the other part of the comparison.

Thanks AWOL! I changed the "=" to a "==" and that solved the problem.