I need to determine the speed with which Arduino executes a certain function.
What would be the best time to do that? So far I found something with a Stopwatch class, but I’m wondering if there’s any native method to do that.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A straightforward way is to use the
millis()ormicros()function in the Arduino library. You will have a finer grain result withmicros().For instance:
Read carefully the documentation of
micros(): there are some information about the time resolution.