Go Down

Topic: Problems with serial.print (Read 2621 times) previous topic - next topic


Hi, I have this code.

Code: [Select]
int sum=0;
int b=20;

void setup() {

void loop() {
  sum = sum + b;
  if (sum==800) {



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


Connection resets the Arduino.
You can disable this with a simple mod - check your board's documentation.
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


I modded the serial dll used for the com port enumeration, so you can use http://arduino.cc/forum/index.php/topic,118440.0.html to avoid disconnections when opening the arduino.
My website: http://ried.cl


What is the difference between serial.print and serial.printin ?


Println adds a linefeed at the end of the printed text so the next print will be on a new line.



What is the difference between serial.print and serial.printin ?

Note that it is println (with a lower-case L) and not printin (with a lower-case I).

Go Up