Won't break out of for loop I'm new to Arduino and I'm trying to use PWM to generate a tone through a buzzer. I've created a for loop, however, the for loop doesn't seem to break when the variable ms is &lt; 1000000. 

int second = 1000000; //1 second in microseconds

void setup() {
  pinMode(3, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  //Play middle C for 1 second
  for(int ms=0; ms &lt;= second; ms+=3830)
  {
    digitalWrite(3, HIGH);
    delayMicroseconds(1915);
    digitalWrite(3, LOW);
    delayMicroseconds(1915);
    Serial.println(ms);
  }
  Serial.write("Finished C");
}




We can see on the serial output that the value of ms exceeds 1000000 but the for loop is still going. Can anyone see where I am going wrong?
An int can't hold 1000000.  It is a signed 16-bit variable, which means it can only hold between -32768 and +32767.

To store larger numbers you need to use long, or unsigned long which are signed and unsigned 32-bit variables.