Arduino is designed to be easy to use. But what penalty does that impose on instruction execution times? Find out how direct port bit manipulations can speed things up ten fold. Plus a little look at interrupts.

By Julian

Youtuber, shed dweller, solar charge controller aficionado

13 thoughts on “Julian investigates: how slow is arduino?”
  1. Avataaar/Circle Created with python_avatars M Talha Khalid says:

    Why not use FREERTOS library and run progra pararell mean trun on off led on same time and then check output

  2. Avataaar/Circle Created with python_avatars K. Chris Caldwell says:

    Fascinating, and good info. Thanks.

  3. Avataaar/Circle Created with python_avatars Gaurav Kakkar says:

    hello sir
    arduino nano in india

  4. Avataaar/Circle Created with python_avatars NalaNate says:

    I basically do this stuff as my job lol oh man i love arduino timer interrupts

  5. Avataaar/Circle Created with python_avatars Gerry McErlean says:

    Thank you. Extremely well explained. Doesn't the Arduino also have a 'micros' function which keeps a count of the elapsed microseconds? Does this also use an interrupt?

  6. Avataaar/Circle Created with python_avatars jstro-hobbytech says:

    Wouldn't using a more efficient compiler make a massive difference? Just a simple machine code loop then use an avr programmer.

  7. Avataaar/Circle Created with python_avatars Jim Smart says:

    Keeps calling high-level function calls โ€œinstructionsโ€, as if they were assembly language. Clearly doesnโ€™t understand how much assembly C/C++ code actually gets compiled into. This video should be called โ€œHow slow is C/C++?โ€.

  8. Avataaar/Circle Created with python_avatars Bennie Hurter says:

    How do I read a complete port in a similar way that what you wrote to a port without using the Digital write function?

  9. Avataaar/Circle Created with python_avatars George George says:

    By the way these solderless prototype boards have very large internal capacitance that can alter the final results of the circuit.But writing in the arduino language seems like talking in some native's language that give things their own names and they known nothing other about 'em except ready made examples and sketches that are dont able even to alter them.

  10. Avataaar/Circle Created with python_avatars Firas Faham ูุฑุงุณ ูุญุงู… says:

    Remember that the sampling capability of your scope may not be linear relative to slowing down and speeding up the time scale. May I ask what is the sampling capability of your scope? And if it maintains the same sampling rate at this very slow time scale? You are doing great job BTW.

  11. Avataaar/Circle Created with python_avatars davepauljones says:

    Thanks Julian, I wonder if the bootloader is taking up any cycles or resources.

  12. Avataaar/Circle Created with python_avatars John Colby says:

    Two things. C++ is closer to the metal but it is not assembler.

    1) Each line of code will be 1 to n lines of assembler.

    2) any function call in c++ pushes values onto the stack and the return pops those values off the stack… Or potentially anyway. Pushes and pops are moving registers to / from memory and take time.

    3) use an xor to flip the bit. That should leave the other bits of the register alone.

  13. Avataaar/Circle Created with python_avatars S4RG3 says:

    For what it is, and what it costs, it is still an impressive little piece of hardware. Thanks for the insightful video,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.