Skip to main content
2 of 2
added 1 character in body
CrossRoads
  • 2.4k
  • 7
  • 9

Comment out these 2 lines

Serial.print("the value is=");
Serial.print("\t");

And report back on the speed difference. Why not add a reading of micros() before and after each loop and see how much difference there really is? All time variables are unsigned long.

startTime = micros();
// your loop
endTime =  micros();
duration = endTime - startTime;
Serial.println (" "); // line break
Serial.print ("duration in uS = ");
Serial.println (duration);

I edited to add some missing )s and a 2nd line break.

CrossRoads
  • 2.4k
  • 7
  • 9