user61204: For the following program. Compiles and runs. I start the Serial Monitor (shown following code) and it asks me to input the Blink Rate. This runs in setup. Then it enters the loop and prints to the serial monitor the rate and starts the >Serial.println("the bl    And it hangs! I can exit the serial monitor and restart it and it does the same thing. So the program/sketch seems to be running fine but somehow the serial communication hangs?  Others have tried it and it works for them?  Using an Alien Aurora R5 running Win10 64bit Home.  Added some delays after another person tried it and it hung on them before adding delay and then ran for them.  They are using Win10 32bit and when tried on their 64bit laptop it hangs.
//Testing the Serial Port

#include <TimerOne.h>

int state = 0;
int value;
long int newtime;

void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  digitalWrite(13, state);
  Serial.println("Enter the Blink Rate: ");
}

void loop() {
  if (Serial.available()) {
    value = Serial.parseInt();
    delay(100);
    Serial.print("the blink rate is: ");
    Serial.println(value);
    Serial.println("Enter a new blink rate: ");
    newtime = value * 1000000;
    Timer1.initialize(newtime);
    Timer1.attachInterrupt(blinkme);
    delay(500);
  }
}

void blinkme() {
  state = !state;
  digitalWrite(13, state);
  delay(100);
}



user37622: If you enter 1 in Serial Monitor and you have line ends selected, the Serial Monitor sends "1\r\n". parseInt() reads 1 and in next loop \r or \n is available and parses as 0. You then set the Timer to 0. The Serial can't finish printing because the Timer fires without a pause.

61204: <p>For the following program. Compiles and runs. I start the Serial Monitor (shown following code) and it asks me to input the Blink Rate. This runs in setup. Then it enters the loop and prints to the serial monitor the rate and starts the >Serial.println("the bl    And it hangs! I can exit the serial monitor and restart it and it does the same thing. So the program/sketch seems to be running fine but somehow the serial communication hangs?  Others have tried it and it works for them?  Using an Alien Aurora R5 running Win10 64bit Home.  Added some delays after another person tried it and it hung on them before adding delay and then ran for them.  They are using Win10 32bit and when tried on their 64bit laptop it hangs.</p>

<pre><code>//Testing the Serial Port

#include &lt;TimerOne.h&gt;

int state = 0;
int value;
long int newtime;

void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  digitalWrite(13, state);
  Serial.println("Enter the Blink Rate: ");
}

void loop() {
  if (Serial.available()) {
    value = Serial.parseInt();
    delay(100);
    Serial.print("the blink rate is: ");
    Serial.println(value);
    Serial.println("Enter a new blink rate: ");
    newtime = value * 1000000;
    Timer1.initialize(newtime);
    Timer1.attachInterrupt(blinkme);
    delay(500);
  }
}

void blinkme() {
  state = !state;
  digitalWrite(13, state);
  delay(100);
}
</code></pre>

<p><a href="https://i.stack.imgur.com/8ge1i.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8ge1i.jpg" alt="Serial Monitor"></a></p>
 37622: <p>If you enter 1 in Serial Monitor and you have line ends selected, the Serial Monitor sends "1\r\n". parseInt() reads 1 and in next loop \r or \n is available and parses as 0. You then set the Timer to 0. The Serial can't finish printing because the Timer fires without a pause.</p>
