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