Conceptual question about Arduino's loop() "speed" in relation to Serial.print


is there relation between output serial port on arduino , time "spend" in each runloop?

i mean, if had this:

code: [select]
void loop ()
{
    // whole bunch of serial.print() , serial.println()
}


1) loop slow down depending on amount of data outputted serial port?
2) can measure speed running at?

these questions arise project idea had blink laser @ high frequency photoresistor not "blinks" , miss few. based on serial.print() output don't know actual run loops printed out or if skipped. or maybe other problem entirely questions still remain in head.

thanks!

1) loop slow down depending on amount of data outputted serial port?


of course.

quote
2) can measure speed running at?


yes...

code: [select]
void loop( void )
{
  static unsigned long previous;
  unsigned long now;
  unsigned long delta;

  = micros();
  delta = - previous;
  previous = now;

  // delta = time spent in last call loop

  // stuff goes here
}


or...

code: [select]
void loop( void )
{
  static unsigned long previous;
  unsigned long now;
  unsigned long delta;

  // stuff goes here

  = micros();
  delta = - previous;
  previous = now;

  // delta = time spent in call loop
}


Arduino Forum > Using Arduino > Project Guidance > Conceptual question about Arduino's loop() "speed" in relation to Serial.print


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62