Serial or Speed..

preview_player
Показать описание
This video demonstrates the speed difference between serial enabled/disabled on an Arduino Uno while toggling a pin output. Just a really simple test of how fast it can pull a pin high and low (without using direct port manipulation), with and with out serial enabled. I think that was the smallest Arduino sketch I ever wrote..
Рекомендации по теме
Комментарии
Автор

A testament to the quality of the arduino API

PeterWorkman
Автор

Or, don't go out of the "loop" function until it's safe for your program to do so. You don't know what the hell the code outside the function does (unless you check the library source code, of course). That delay literally happens because an extra if evaluates to true or so.
Even with serial disabled, notice the glitches in the wavefom. That's not the scope acting or anything. That's the same thing. Maybe the library does something special every 256th time it run or something along those lines.

Gameboygenius
Автор

Know this is pretty old now but just curious, if you were to perform a "Serial.end()" in the setup function, would there still be a performance penalty? e.g. When I startup, I use Serial.begin() to dump out some metrics I have stored in the non-volatile memory to the serial port but then I "end()" it.

brianengel