TimerOne Hanging

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.

//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);
}

Serial monitor: see attachment

Delays have been commented out and no change.

You should never have a delay in an interrupt routine. First, I would remove the serial wait, hardcode a time, and make sure the blink works with timer 1. Also, you probably want to test for the user entering a 0 time. You can skip initializing the timer if a 0 is entered and/or detach the interrupt and warn the user a 0 time was entered.

Answer found! Had to set the monitor to No Line Ending

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.