Answer the question
In order to leave comments, you need to log in
Why does Serial stop working in Arduino?
Hello everyone, I have such a problem - for some reason, after continuously sending messages using Serial.print, sending stops working after a while, I wrote a simple test program:
int time = 0;
int count = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("test");
}
void loop() {
// put your main code here, to run repeatedly:
delay(11);
if(millis() > time) {
count++;
Serial.println(count);
time = millis() + 1000;
}
}
Answer the question
In order to leave comments, you need to log in
Sorry, I lied to you a little, it's in the int, hike.
Make numbers the same size as millis() and everything will be fine)
unsigned long time = 0;
unsigned long count = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("test");
}
void loop() {
// put your main code here, to run repeatedly:
delay(11);
if(millis() > time) {
count++;
Serial println(count);
Serial println(millis());
Serial println(time);
time = millis() + 1000;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question