Hi, I have this code.
int sum=0;
int b=20;
void setup() {
Serial.begin(9600);
}
void loop() {
sum = sum + b;
if (sum==800) {
sum=0;
}
Serial.println(sum);
delay(1000);
}
So I upload the code, start the serial monitor and I can see 20, 40, 60 etc.
I disconnect the serial monitor and connect again a couple of seconds later. I expect 240, 260, 280. But I can see it starts from the beginning with 20, 40 .... When I'm online with the serial monitor it works as expected.
Maybe anyone can tell me why?
thx in adavance