{"id":8792,"date":"2023-04-24T09:24:35","date_gmt":"2023-04-24T07:24:35","guid":{"rendered":"https:\/\/deepbluembedded.com\/?p=8792"},"modified":"2025-07-26T14:15:02","modified_gmt":"2025-07-26T11:15:02","slug":"arduino-delaymicroseconds-function-tutorial","status":"publish","type":"post","link":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/","title":{"rendered":"Arduino delayMicroseconds() Function Tutorial"},"content":{"rendered":"\n<p class=\"has-text-align-justify\">In this tutorial, you&#8217;ll learn how to use the <strong>Arduino delayMicroseconds() function<\/strong> and how it actually works. We&#8217;ll also investigate the <strong>accuracy <\/strong>of the Arduino delayMicroseconds() function and do some measurements to reach its fundamental limitations of it. And we&#8217;ll discuss what would be a better alternative if needed by your application.<\/p>\n\n\n\n<p>Without further ado, let&#8217;s get right into it!<\/p>\n\n\n<h2 class=\"simpletoc-title\">Table of Contents<\/h2>\n<ol class=\"simpletoc-list\">\n<li><a href=\"#the-need-for-delaymicroseconds-in-arduino\">The Need For delayMicroseconds in Arduino<\/a>\n\n<\/li>\n<li><a href=\"#arduino-delaymicroseconds-function\">Arduino delayMicroseconds() Function<\/a>\n\n<\/li>\n<li><a href=\"#arduino-delaymicroseconds-example\">Arduino delayMicroseconds Example<\/a>\n\n\n\n<\/li>\n\n<\/li>\n\n<\/li>\n\n<\/li>\n\n<li><a href=\"#arduino-delaymicroseconds-accuracy-tests\">Arduino delayMicroseconds Accuracy Tests<\/a>\n\n\n<\/li>\n\n<li><a href=\"#concluding-remarks\">Concluding Remarks<\/a>\n<\/li><\/ol>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-e732159f gb-headline-text\" id=\"the-need-for-delaymicroseconds-in-arduino\"><strong>The Need For delayMicroseconds in Arduino<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">In a previous tutorial, we&#8217;ve discussed in detail the <a href=\"https:\/\/deepbluembedded.com\/arduino-delay-function-tutorial\/\"><strong>Arduino delay() function<\/strong><\/a> and how to use it in your Arduino projects to generate time delays in milliseconds and up to 25 days. But in this tutorial, we&#8217;ll go down to very precise time delay intervals generation down to 1\u00b5s and measure the accuracy of the Arduino delayMicroseconds built-in function.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">Occasionally, you might need to insert a very short time delay to achieve certain functionality for your Arduino projects. Things like short pulse generation, triggering a sensor or external electronic circuit, or forcing the CPU to wait for a short time period before attempting to execute a certain piece of logic.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">Despite the fact that using a delay function is not generally preferred, it&#8217;s still a very popular option for various use cases. And it can be acceptable as long as it&#8217;s a few \u00b5s time delay.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-75b88b26 gb-headline-text\" id=\"arduino-delaymicroseconds-function\"><strong>Arduino delayMicroseconds() Function<\/strong><\/h2>\n\n\n<p><strong>Description<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-justify\">The <code>delayMicroseconds()<\/code> function pauses the program for the amount of time (in microseconds) specified as a parameter. There are 1000 microseconds in a millisecond and 1,000,000 microseconds in a second.<\/p>\n\n\n\n<p class=\"has-text-align-justify\"><strong>Syntax<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">delayMicroseconds(us);<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Parameters<\/strong><\/p>\n\n\n\n<p><code>us<\/code>: the number of microseconds to pause. Allowed data types: <code>unsigned int<\/code><\/p>\n\n\n<div class=\"gb-container gb-container-30d92673\"><div class=\"gb-inside-container\">\n<div class=\"gb-headline gb-headline-b04bb8fe gb-headline-text\">\u2755  Note<\/div>\n\n\n<p class=\"has-text-align-justify\">Currently, the largest value that will produce an accurate delay is 16383. Larger values can produce an extremely short delay. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use the&nbsp;<code>delay()<\/code>&nbsp;function instead.<\/p>\n\n<\/div><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-271db9db gb-headline-text\" id=\"arduino-delaymicroseconds-example\"><strong>Arduino delayMicroseconds Example<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">Now, we&#8217;ll test the delayMicroseconds() function with a very simple short pulse generation example.<\/p>\n\n\n<h3 class=\"gb-headline gb-headline-87dba747 gb-headline-text\" id=\"short-pulse-generation-with-delaymicroseconds\">Short Pulse Generation With delayMicroseconds<\/h3>\n\n\n<p class=\"has-text-align-justify\">We&#8217;ll drive an Arduino output pin to <strong>HIGH<\/strong> and insert a short <strong>delay<\/strong> of <strong>100\u00b5s<\/strong>, and then drive it back to <strong>LOW<\/strong>. And the resulting short pulse will be measured with an oscilloscope to make sure it has &#8220;nearly&#8221; the desired pulse width of 100\u00b5s.<\/p>\n\n\n<h4 class=\"gb-headline gb-headline-0fcc3806 gb-headline-text\" id=\"example-code\">Example Code<\/h4>\n\n\n<p>Here is the full code listing for this example.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/*\n * LAB Name: Arduino delayMicroseconds Example\n * Author: Khaled Magdy\n * For More Info Visit: www.DeepBlueMbedded.com\n*\/\n\n#define TEST_PIN 8\n\nvoid setup()\n{\n  pinMode(TEST_PIN, OUTPUT);\n}\n\nvoid loop()\n{\n  digitalWrite(TEST_PIN, HIGH);\n  delayMicroseconds(100); \/\/ Delay for 100us\n  digitalWrite(TEST_PIN, LOW);\n  \/\/ Delay Between Pulses\n  delay(100); \/\/ Delay for 100ms\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n<h4 class=\"gb-headline gb-headline-ae3ab081 gb-headline-text\" id=\"code-explanation\">Code Explanation<\/h4>\n\n\n<p class=\"has-text-align-justify\">The code example simply sets pin 8 to be output and sends output signal High and Low with 100\u00b5s time delay after each state change.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>setup()<\/strong><\/p>\n\n\n\n<p>in the <code>setup()<\/code> function, we initialize the digital IO pin 8 to be an <code>OUTPUT<\/code> pin.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>loop()<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-justify\">in the <code>loop()<\/code> function, we use the <code>digitalWrite()<\/code> function to set the pin state to high and low. And we also use the delayMicroseconds() function to insert a 100\u00b5s time delay after each state change. And we also insert a 100ms time delay after each pulse.<\/p>\n\n\n<h4 class=\"gb-headline gb-headline-61a15e4d gb-headline-text\" id=\"simulation\">Simulation<\/h4>\n\n\n<p>Here is the simulation result for this project on the Proteus simulator (it can be helpful if you don&#8217;t have an oscilloscope in your lab yet).<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-75edb45a\"><img loading=\"lazy\" decoding=\"async\" width=\"1917\" height=\"1003\" class=\"gb-image gb-image-75edb45a\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Simulation.png\" alt=\"Arduino-delayMicroseconds-Example-Simulation\" title=\"Arduino-delayMicroseconds-Example-Simulation\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Simulation.png 1917w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Simulation-300x157.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Simulation-1024x536.png 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Simulation-768x402.png 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Simulation-1536x804.png 1536w\" sizes=\"auto, (max-width: 1917px) 100vw, 1917px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-left\"><\/p>\n\n\n\n<p>The resulting pulse is nearly 100\u00b5s as we expect with a slight error of around 1.5\u00b5s.<\/p>\n\n\n<div class=\"gb-container gb-container-8529537a\"><div class=\"gb-inside-container\">\n<div class=\"gb-headline gb-headline-9d152e12 gb-headline-text\">????  Also Read<\/div>\n\n<div class=\"gb-grid-wrapper gb-grid-wrapper-3f26d73f\">\n<div class=\"gb-grid-column gb-grid-column-22852764\"><div class=\"gb-container gb-container-22852764\"><div class=\"gb-inside-container\">\n\n<figure class=\"gb-block-image gb-block-image-01f16985\"><a href=\"https:\/\/deepbluembedded.com\/arduino-proteus-library-download-simulation-tutorial\/\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"169\" class=\"gb-image gb-image-01f16985\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Proteus-Library-Simulation-Guide-300x169.jpg\" alt=\"Arduino Proteus Library Simulation Guide\" title=\"Arduino Proteus Library Simulation Guide\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Proteus-Library-Simulation-Guide-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Proteus-Library-Simulation-Guide-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Proteus-Library-Simulation-Guide-768x432.jpg 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Proteus-Library-Simulation-Guide.jpg 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/figure>\n\n<\/div><\/div><\/div>\n\n<div class=\"gb-grid-column gb-grid-column-da0e28de\"><div class=\"gb-container gb-container-da0e28de\"><div class=\"gb-inside-container\">\n<div class=\"gb-headline gb-headline-2055a487 gb-headline-text\"><a href=\"https:\/\/deepbluembedded.com\/arduino-proteus-library-download-simulation-tutorial\/\">Arduino Proteus Simulation Guide<\/a><\/div>\n\n\n<p>This article will give more in-depth information about using proteus ISIS for Arduino projects simulation.<\/p>\n\n<\/div><\/div><\/div>\n<\/div>\n<\/div><\/div>\n\n<h4 class=\"gb-headline gb-headline-3b8e9ada gb-headline-text\" id=\"testing-results\">Testing Results<\/h4>\n\n\n<p class=\"has-text-align-justify\">Here is the result of testing this project on my Arduino UNO board as captured by my DSO (digital storage oscilloscope). It&#8217;s nearly the same as what we&#8217;ve seen in the simulation environment.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-8a559666\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"480\" class=\"gb-image gb-image-8a559666\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Test.png\" alt=\"Arduino-delayMicroseconds-Example-Test\" title=\"Arduino-delayMicroseconds-Example-Test\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Test.png 800w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Test-300x180.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Example-Test-768x461.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n<h4 class=\"gb-headline gb-headline-cc569e6a gb-headline-text\" id=\"interesting-finding\">Interesting Finding<\/h4>\n\n\n<p class=\"has-text-align-justify\">The behavior I&#8217;ll describe here is consistent and easily observable in both simulation environment and in real-world testing. Which is a significant fluctuation in the resulting pulse width (around 10\u00b5s), and it&#8217;s sporadic in time.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">It turned out to be due to having interrupts that pause the <code>delayMicroseconds()<\/code> function execution causing it to take more time than expected in a non-deterministic way. One solution can be to disable interrupts before the &#8220;short microseconds delay&#8221; and re-enable interrupts afterward. Which is not recommended actually. But for the sake of testing, I&#8217;ll modify the code and run the test again.<\/p>\n\n\n\n<p>Here is the modified code example.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/*\n * LAB Name: Arduino delayMicroseconds Modified Example\n * Author: Khaled Magdy\n * For More Info Visit: www.DeepBlueMbedded.com\n*\/\n\n#define TEST_PIN 8\n\nvoid setup()\n{\n  pinMode(TEST_PIN, OUTPUT);\n}\n\nvoid loop()\n{\n  noInterrupts(); \/\/ Disable Interrupts\n  digitalWrite(TEST_PIN, HIGH);\n  delayMicroseconds(100); \/\/ Delay for 100us\n  digitalWrite(TEST_PIN, LOW);\n  interrupts();  \/\/ Re-Enable Interrupts\n  \/\/ Delay Between Pulses\n  delay(100); \/\/ Delay for 100ms\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">After running the example code above, it did eliminate the sporadic fluctuation in the delay microseconds period (pulse width). But as stated earlier, disabling interrupts for critical sections in your code is something that you need to be very careful with or avoid as much as possible.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<h2 class=\"gb-headline gb-headline-03e91692 gb-headline-text\" id=\"arduino-delaymicroseconds-accuracy-tests\"><strong>Arduino delayMicroseconds Accuracy Tests<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">In this section, we&#8217;ll do some further test procedures to measure the accuracy of the Arduino delayMicroseconds function.<\/p>\n\n\n<h3 class=\"gb-headline gb-headline-4e99e090 gb-headline-text\" id=\"delaymicroseconds-accuracy-measurement-test1\">delayMicroseconds Accuracy Measurement Test1<\/h3>\n\n\n<p class=\"has-text-align-justify\">In this testing procedure, we&#8217;ll use the built-in timer-based micros() function to find out the execution time of the delay generated by the delayMicroseconds function. Given that the micros() function output is always multiples of 4, we&#8217;ll select a time delay of 100\u00b5s so it doesn&#8217;t affect the results we&#8217;ll be getting.<\/p>\n\n\n\n<p>Here is the code example for this test.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/*\n * LAB Name: Arduino delayMicroseconds Accuracy Test1\n * Author: Khaled Magdy\n * For More Info Visit: www.DeepBlueMbedded.com\n*\/\n\nunsigned long T1, T2;\n\nvoid setup()\n{\n  Serial.begin(9600);\n}\n\nvoid loop()\n{\n  T1 = micros();\n  delayMicroseconds(100);\n  T2 = micros();\n  Serial.println(T2-T1);\n  delay(1000);\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>And here is the result for running this code on my Arduino UNO board.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-f4e55fce\"><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"420\" class=\"gb-image gb-image-f4e55fce\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test.png\" alt=\"Arduino delayMicroseconds Accuracy Test\" title=\"Arduino delayMicroseconds Accuracy Test\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test.png 814w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test-300x155.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test-768x396.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">Do you remember from the previous example the sporadic fluctuation in the generated time delay? Here it&#8217;s also visible again. And we&#8217;ll eliminate it with the exact same way of creating a critical section for the delayMicroseconds function call (by disabling\/enabling Interrupts).<\/p>\n\n\n\n<p>And here is the modified test code example.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/*\n * LAB Name: Arduino delayMicroseconds Accuracy Test1\n * Author: Khaled Magdy\n * For More Info Visit: www.DeepBlueMbedded.com\n*\/\n\nunsigned long T1, T2;\n\nvoid setup()\n{\n  Serial.begin(9600);\n}\n\nvoid loop()\n{\n  noInterrupts(); \/\/ Disable Interrupts\n  T1 = micros();\n  delayMicroseconds(100);\n  T2 = micros();\n  interrupts();  \/\/ Re-Enable Interrupts\n  Serial.println(T2-T1);\n  delay(1000);\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-justify\">And here is the result for running the modified test code example above. It&#8217;s a little bit better but still, there is a consistent random 4\u00b5s error. Which will stay the same whether you increase or decrease the delayMicroseconds time period. I went up to a 600\u00b5s time delay and it was printing 600s and 604s as well. So it&#8217;s something consistent and I believe it&#8217;s inherent in the <code>micros()<\/code> function implementation itself.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-1e1be58a\"><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"422\" class=\"gb-image gb-image-1e1be58a\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test1.png\" alt=\"Arduino delayMicroseconds Accuracy Measurement\" title=\"Arduino delayMicroseconds Accuracy Test1\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test1.png 814w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test1-300x156.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test1-768x398.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n<h3 class=\"gb-headline gb-headline-9cda7dcf gb-headline-text\" id=\"delaymicroseconds-accuracy-measurement-test2\">delayMicroseconds Accuracy Measurement Test2<\/h3>\n\n\n<p class=\"has-text-align-justify\">In this test procedure, I&#8217;ll replace the <code>micros()<\/code> function calls with direct pin access to eliminate the execution time effect of the <code>digitalWrite()<\/code> function and also avoid any effect introduced by the implementation of the micros function itself.<\/p>\n\n\n\n<p>And I&#8217;ll run the test code on both the simulation environment and a real Arduino board with an oscilloscope to check if things are going to align or not.<\/p>\n\n\n\n<p>Here is the code example for this test procedure. Note that I&#8217;m using <code>PORTD<\/code> bit 3 which corresponds to Arduino digital IO pin number 3.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/*\n * LAB Name: Arduino delayMicroseconds Accuracy Test2\n * Author: Khaled Magdy\n * For More Info Visit: www.DeepBlueMbedded.com\n*\/\n\nvoid setup()\n{\n  DDRD = DDRD | 0x08;\n}\n\nvoid loop()\n{\n  noInterrupts(); \/\/ Disable Interrupts\n  PORTD |= (1 &lt;&lt; 3);\n  delayMicroseconds(100);\n  PORTD &amp;= ~(1 &lt;&lt; 3);\n  interrupts();  \/\/ Re-Enable Interrupts\n  delay(100);\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>And here is the result of running this test code in both simulation and on a real Arduino UNO board.<\/p>\n\n\n<table style=\"border-collapse: collapse; width: 100%; height: 361px;\">\n<tbody>\n<tr style=\"height: 22px;\">\n<td style=\"width: 50%; text-align: center; height: 22px;\"><strong>Real Arduino + DSO Result<\/strong><\/td>\n<td style=\"width: 50%; text-align: center; height: 22px;\"><strong>Proteus Simulation Result<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 339px;\">\n<td style=\"width: 50%; height: 339px;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8799\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Measurement-2.png\" alt=\"Arduino delayMicroseconds Accuracy Measurement 2\" width=\"800\" height=\"480\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Measurement-2.png 800w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Measurement-2-300x180.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Measurement-2-768x461.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/td>\n<td style=\"width: 50%; height: 339px;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8800\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test2.png\" alt=\"Arduino delayMicroseconds Accuracy Test2\" width=\"1765\" height=\"882\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test2.png 1765w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test2-300x150.png 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test2-1024x512.png 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test2-768x384.png 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Accuracy-Test2-1536x768.png 1536w\" sizes=\"auto, (max-width: 1765px) 100vw, 1765px\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n<p>Which is quite an interesting result. Both pulses are very similar 98.6\u00b5s and 98.5\u00b5s. And also less than the expected 100\u00b5s pulse width.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">Then, I proceeded with changing the delayMicroseconds input time delay down to 1\u00b5s. And here are the results I&#8217;ve got on my DSO after measuring the pulse width in each test case.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>Test Case<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Measured Pulse Width on DSO<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><code>delayMicroseconds(100);<\/code><\/td><td class=\"has-text-align-center\" data-align=\"center\">98.6\u00b5s<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><code>delayMicroseconds(10);<\/code><\/td><td class=\"has-text-align-center\" data-align=\"center\">9\u00b5s<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><code>delayMicroseconds(2);<\/code><\/td><td class=\"has-text-align-center\" data-align=\"center\">0.9\u00b5s<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><code>delayMicroseconds(1);<\/code><\/td><td class=\"has-text-align-center\" data-align=\"center\">0.2\u00b5s<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"has-text-align-justify\">To conclude this accuracy testing section, we can say that the Arduino delayMicroseconds function is pretty much accurate for general-purpose delay applications. However, there still are some fundamental limitations to what you can expect from this function and you&#8217;d be better off implementing your own delay routine if you need to have an extremely accurate and predictable behavior in your target application.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">Otherwise, the delayMicroseconds will serve you well in most applications where a delay of a few \u00b5s is required and nobody is really concerned about the accuracy (or consistency) of the generated delay intervals.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<div class=\"gb-container gb-container-4ee53656\"><div class=\"gb-inside-container\">\n\n<p class=\"gb-headline gb-headline-2701efd7 gb-headline-text\"><strong>Parts List<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-justify\">Here is the full components list for all parts that you&#8217;d need in order to perform the practical LABs mentioned here in this article and for the whole Arduino Programming series of tutorials found here on DeepBlueMbedded. Please, note that those are affiliate links and we&#8217;ll receive a small commission on your purchase at no additional cost to you, and it&#8217;d definitely support our work.<\/p>\n\n\n<div class=\"gb-button-wrapper gb-button-wrapper-7cf4dd75\">\n\n<a class=\"gb-button gb-button-47f15bc4 gb-button-text\" href=\"https:\/\/www.amazon.com\/shop\/deepbluembedded\/list\/1HTCD77Q43SNG?ref_=cm_sw_r_cp_ud_aipsflist_aipsfdeepbluembedded_GJ0DQ9YAJBQFPDHHB7PM\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Arduino Course Kit List<\/a>\n\n<\/div>\n<\/div><\/div>\n\n\n<p>This is the main DSO that I usually use in my lab in case you need one for your lab. You definitely need to check it out!<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-b2dc776b\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"184\" class=\"gb-image gb-image-b2dc776b\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2021\/04\/sds1204x-e-hero-1200x735-White-b-300x184.jpg\" alt=\"\" title=\"sds1204x-e-hero-1200x735-White-b\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2021\/04\/sds1204x-e-hero-1200x735-White-b-300x184.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2021\/04\/sds1204x-e-hero-1200x735-White-b-1024x627.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2021\/04\/sds1204x-e-hero-1200x735-White-b-768x470.jpg 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2021\/04\/sds1204x-e-hero-1200x735-White-b.jpg 1200w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center\"><a href=\"https:\/\/amzn.to\/2Na9oSW\" target=\"_blank\" rel=\"noreferrer noopener\">Amazon.com<\/a>&nbsp;&nbsp; &#8211;  <a href=\"https:\/\/www.ebay.com\/itm\/SIGLENT-SDS1104X-E-Super-Phosphor-Oscilloscope-4-channel-100-MHz-1-GSa-s-14-MB\/142804414849?epid=6028678012&amp;hash=item213fce7181:g:E4UAAOSw7aFbA-Bz&amp;mkcid=1&amp;mkrid=711-53200-19255-0&amp;siteid=0&amp;campid=5338740127&amp;customid=Deep20Blue&amp;toolid=10001&amp;mkevt=1\" target=\"_blank\" rel=\"noreferrer noopener\">ebay.com<\/a>  &#8211;  <a href=\"https:\/\/s.click.aliexpress.com\/e\/_DC7ar8N\" target=\"_blank\" rel=\"noreferrer noopener\">AliExpress<\/a><\/p>\n\n\n<div class=\"gb-container gb-container-4ee53656\"><div class=\"gb-inside-container\">\n<p class=\"gb-headline gb-headline-2701efd7 gb-headline-text\"><strong>Download Attachments<\/strong><\/p>\n\n\n<p style=\"text-align: justify;\">You can download all attachment files for this Article\/Tutorial (project files, schematics, code, etc..) using the link below. Please consider supporting my work through the various support options listed in the link down below. Every small donation helps to keep this website up and running and ultimately supports our community.<\/p>\n\n\n<div class=\"gb-grid-wrapper gb-grid-wrapper-2155b8e3\">\n<div class=\"gb-grid-column gb-grid-column-13e0597a\"><div class=\"gb-container gb-container-13e0597a\"><div class=\"gb-inside-container\">\n<div class=\"gb-button-wrapper gb-button-wrapper-7cf4dd75\">\n\n<a class=\"gb-button gb-button-47f15bc4 gb-button-text\" href=\"https:\/\/drive.google.com\/file\/d\/11IJBDvs0dA2VfTPPUey4ek4ovW17_Zdg\/view?usp=sharing\" target=\"_blank\" rel=\"noopener noreferrer\">DOWNLOAD<\/a>\n\n<\/div>\n<\/div><\/div><\/div>\n\n<div class=\"gb-grid-column gb-grid-column-37f853aa\"><div class=\"gb-container gb-container-37f853aa\"><div class=\"gb-inside-container\">\n<div class=\"gb-button-wrapper gb-button-wrapper-c15cbd3e\">\n\n<a class=\"gb-button gb-button-2b1899ec gb-button-text\" href=\"https:\/\/deepbluembedded.com\/support-me\/\" target=\"_blank\" rel=\"noopener noreferrer\">DONATE HERE<\/a>\n\n<\/div>\n<\/div><\/div><\/div>\n<\/div>\n\n\n<hr class=\"wp-block-separator aligncenter has-text-color has-contrast-color has-alpha-channel-opacity has-contrast-background-color has-background is-style-default\"\/>\n\n<\/div><\/div>\n\n<h2 class=\"gb-headline gb-headline-dc00790f gb-headline-text\" id=\"concluding-remarks\"><strong>Concluding Remarks<\/strong><\/h2>\n\n\n<p class=\"has-text-align-justify\">To conclude this tutorial, we can say that the Arduino delayMicroseconds function is pretty much accurate for general-purpose delay applications. However, there still are some fundamental limitations to what you can expect from this function and you&#8217;d be better off implementing your own delay routine if you need to have an extremely accurate and predictable behavior in your target application.<\/p>\n\n\n\n<p class=\"has-text-align-justify\">Using the delay() and delayMicroseconds() functions is pretty much easy. But you need to be very careful and use them reasonably because it can lead to major timing issues in your system. And in most cases, you&#8217;d be better off avoiding using delays altogether.<\/p>\n\n\n\n<p>In the following cases, it&#8217;d be acceptable to use delays in your Arduino projects:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>During initialization, to make sure that a software component has completed initialization successfully<\/li>\n\n\n\n<li>If you purposefully need the CPU to be blocked waiting for a certain event<\/li>\n\n\n\n<li>If the delay time is very short like 10\u00b5s or something in that range<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-justify\">If you&#8217;re just getting started with Arduino, you need to check out the <a href=\"https:\/\/deepbluembedded.com\/arduino-getting-started-beginners-guide\/\"><strong>Arduino Getting Started [Ultimate Guide]<\/strong><\/a> here. And follow this Arduino series of tutorials to learn more about Arduino Programming.<\/p>\n\n\n<div class=\"gb-container gb-container-92ab6065\"><div class=\"gb-inside-container\">\n<div class=\"gb-headline gb-headline-a183174b gb-headline-text\">????  Also Read<\/div>\n\n<div class=\"gb-grid-wrapper gb-grid-wrapper-e44c324a\">\n<div class=\"gb-grid-column gb-grid-column-5c0d59dd\"><div class=\"gb-container gb-container-5c0d59dd\"><div class=\"gb-inside-container\">\n\n<figure class=\"gb-block-image gb-block-image-5bca1b21\"><a href=\"https:\/\/deepbluembedded.com\/arduino-getting-started-beginners-guide\/\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"169\" class=\"gb-image gb-image-5bca1b21\" src=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Getting-Started-With-Arduino-Programming-For-Beginners-300x169.jpg\" alt=\"Getting Started With Arduino Programming For Beginners\" title=\"Getting Started With Arduino Programming For Beginners\" srcset=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Getting-Started-With-Arduino-Programming-For-Beginners-300x169.jpg 300w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Getting-Started-With-Arduino-Programming-For-Beginners-1024x576.jpg 1024w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Getting-Started-With-Arduino-Programming-For-Beginners-768x432.jpg 768w, https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Getting-Started-With-Arduino-Programming-For-Beginners.jpg 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/figure>\n\n<\/div><\/div><\/div>\n\n<div class=\"gb-grid-column gb-grid-column-91f105c4\"><div class=\"gb-container gb-container-91f105c4\"><div class=\"gb-inside-container\">\n<div class=\"gb-headline gb-headline-1eb6c9d0 gb-headline-text\"><a href=\"https:\/\/deepbluembedded.com\/arduino-getting-started-beginners-guide\/\" rel=\"nofollow\">Getting Started With Arduino [Ultimate Guide]<\/a><\/div>\n\n\n<p class=\"has-text-align-justify\">This is the ultimate guide for getting started with Arduino for beginners. It&#8217;ll help you learn the Arduino fundamentals for Hardware &amp; Software and understand the basics required to accelerate your learning journey with Arduino Programming.<\/p>\n\n<\/div><\/div><\/div>\n<\/div>\n<\/div><\/div>\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<div class=\"gb-container gb-container-1e7bad02\"><div class=\"gb-inside-container\">\n<p class=\"gb-headline gb-headline-292c9f79 gb-headline-text\"><strong>FAQ &amp; Answers<\/strong><\/p>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1657575814713\"><strong class=\"schema-faq-question\">Which timer does delayMicroseconds() use?<\/strong> <p class=\"schema-faq-answer\">The delayMicroseconds() function doesn&#8217;t use a hardware timer, instead, it used the CPU clock cycles count. On the other hand, the [ delay() &#8211; micros() &#8211; millis() ] functions use Timer0 to work (this is for Arduino UNO, Mega, etc).<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1657575939205\"><strong class=\"schema-faq-question\">What is delayMicroseconds () in Arduino?<\/strong> <p class=\"schema-faq-answer\">The Arduino delayMicroseconds() function is a built-in function that pauses the CPU for a short time interval (in \u00b5s). Currently, the largest value that will produce an accurate delay is 16383. Larger values can produce an extremely short delay. For delays longer than a few thousand microseconds, you should use the\u00a0<code>delay()<\/code>\u00a0function instead.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1680065306913\"><strong class=\"schema-faq-question\">How accurate is Arduino delayMicroseconds?<\/strong> <p class=\"schema-faq-answer\">You can get down to 1\u00b5s time delay using the Arduino delayMicroseconds() function. It&#8217;s pretty much accurate but you need to pay attention to the fact that any enabled interrupt can interfere with the operation of the delayMicroseconds function which is going to prolong the delay period. And potentially causing it to generate inconsistent time delay intervals. Creating a critical section around the delayMicroseconds function call will solve the issue but needs careful implementation.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1680065383847\"><strong class=\"schema-faq-question\">What is Arduino delayMicroseconds max value?<\/strong> <p class=\"schema-faq-answer\">Currently, the largest value that will produce an accurate delay is 16383. Larger values can produce an extremely short delay. For delays longer than a few thousand microseconds, you should use the\u00a0<code>delay()<\/code>\u00a0function instead.<\/p> <\/div> <\/div>\n\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p> &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Arduino delayMicroseconds() Function Tutorial\" class=\"read-more button\" href=\"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#more-8792\" aria-label=\"Read more about Arduino delayMicroseconds() Function Tutorial\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":8806,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[274,28,30],"tags":[278],"class_list":["post-8792","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-embedded-systems","category-embedded-tutorials","tag-arduino-core","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Arduino delayMicroseconds() Function Tutorial<\/title>\n<meta name=\"description\" content=\"Arduino delayMicroseconds() Function Tutorial. Arduino delayMicroseconds Accuracy Measurement, Timer, interrupt. Arduino Examples\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Arduino delayMicroseconds() Function Tutorial\" \/>\n<meta property=\"og:description\" content=\"Arduino delayMicroseconds() Function Tutorial. Arduino delayMicroseconds Accuracy Measurement, Timer, interrupt. Arduino Examples\" \/>\n<meta property=\"og:url\" content=\"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"DeepBlue\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/khaled.elrawy.359\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/khaled.elrawy.359\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-24T07:24:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-26T11:15:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Function-Tutorial.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Khaled Magdy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khaled Magdy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/\"},\"author\":{\"name\":\"Khaled Magdy\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"headline\":\"Arduino delayMicroseconds() Function Tutorial\",\"datePublished\":\"2023-04-24T07:24:35+00:00\",\"dateModified\":\"2025-07-26T11:15:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/\"},\"wordCount\":1805,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"image\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/Arduino-delayMicroseconds-Function-Tutorial.jpg\",\"keywords\":[\"Arduino Core\"],\"articleSection\":[\"Arduino\",\"Embedded Systems\",\"Embedded Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#respond\"]}]},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/\",\"name\":\"Arduino delayMicroseconds() Function Tutorial\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/Arduino-delayMicroseconds-Function-Tutorial.jpg\",\"datePublished\":\"2023-04-24T07:24:35+00:00\",\"dateModified\":\"2025-07-26T11:15:02+00:00\",\"description\":\"Arduino delayMicroseconds() Function Tutorial. Arduino delayMicroseconds Accuracy Measurement, Timer, interrupt. Arduino Examples\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#breadcrumb\"},\"mainEntity\":[{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1657575814713\"},{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1657575939205\"},{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1680065306913\"},{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1680065383847\"}],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#primaryimage\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/Arduino-delayMicroseconds-Function-Tutorial.jpg\",\"contentUrl\":\"https:\\\/\\\/deepbluembedded.com\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/Arduino-delayMicroseconds-Function-Tutorial.jpg\",\"width\":1280,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/deepbluembedded.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Arduino delayMicroseconds() Function Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#website\",\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/\",\"name\":\"DeepBlueMbedded\",\"description\":\"Embedded Systems And Computer Engineering Tutorials &amp; Articles\",\"publisher\":{\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/deepbluembedded.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/#\\\/schema\\\/person\\\/30259d66cf68c6c681562dbe551b7867\",\"name\":\"Khaled Magdy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\",\"caption\":\"Khaled Magdy\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g\"},\"description\":\"Principal Embedded Systems Engineer with years of experience in embedded software and hardware design. I work in the Automotive &amp; e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI\\\/ML, and other fields I'm passionate about. I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?\",\"sameAs\":[\"https:\\\/\\\/deepbluembedded.com\",\"https:\\\/\\\/www.facebook.com\\\/khaled.elrawy.359\\\/\",\"https:\\\/\\\/www.instagram.com\\\/deepbluembedded\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/khaled-magdy-\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCzLSrNZD4rCjSCOVU9hknvA\"]},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1657575814713\",\"position\":1,\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1657575814713\",\"name\":\"Which timer does delayMicroseconds() use?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"The delayMicroseconds() function doesn't use a hardware timer, instead, it used the CPU clock cycles count. On the other hand, the [ delay() - micros() - millis() ] functions use Timer0 to work (this is for Arduino UNO, Mega, etc).\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1657575939205\",\"position\":2,\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1657575939205\",\"name\":\"What is delayMicroseconds () in Arduino?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"The Arduino delayMicroseconds() function is a built-in function that pauses the CPU for a short time interval (in \u00b5s). Currently, the largest value that will produce an accurate delay is 16383. Larger values can produce an extremely short delay. For delays longer than a few thousand microseconds, you should use the\u00a0delay()\u00a0function instead.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1680065306913\",\"position\":3,\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1680065306913\",\"name\":\"How accurate is Arduino delayMicroseconds?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"You can get down to 1\u00b5s time delay using the Arduino delayMicroseconds() function. It's pretty much accurate but you need to pay attention to the fact that any enabled interrupt can interfere with the operation of the delayMicroseconds function which is going to prolong the delay period. And potentially causing it to generate inconsistent time delay intervals. Creating a critical section around the delayMicroseconds function call will solve the issue but needs careful implementation.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1680065383847\",\"position\":4,\"url\":\"https:\\\/\\\/deepbluembedded.com\\\/arduino-delaymicroseconds-function-tutorial\\\/#faq-question-1680065383847\",\"name\":\"What is Arduino delayMicroseconds max value?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Currently, the largest value that will produce an accurate delay is 16383. Larger values can produce an extremely short delay. For delays longer than a few thousand microseconds, you should use the\u00a0delay()\u00a0function instead.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Arduino delayMicroseconds() Function Tutorial","description":"Arduino delayMicroseconds() Function Tutorial. Arduino delayMicroseconds Accuracy Measurement, Timer, interrupt. Arduino Examples","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Arduino delayMicroseconds() Function Tutorial","og_description":"Arduino delayMicroseconds() Function Tutorial. Arduino delayMicroseconds Accuracy Measurement, Timer, interrupt. Arduino Examples","og_url":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/","og_site_name":"DeepBlue","article_publisher":"https:\/\/www.facebook.com\/khaled.elrawy.359\/","article_author":"https:\/\/www.facebook.com\/khaled.elrawy.359\/","article_published_time":"2023-04-24T07:24:35+00:00","article_modified_time":"2025-07-26T11:15:02+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Function-Tutorial.jpg","type":"image\/jpeg"}],"author":"Khaled Magdy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Khaled Magdy","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#article","isPartOf":{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/"},"author":{"name":"Khaled Magdy","@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"headline":"Arduino delayMicroseconds() Function Tutorial","datePublished":"2023-04-24T07:24:35+00:00","dateModified":"2025-07-26T11:15:02+00:00","mainEntityOfPage":{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/"},"wordCount":1805,"commentCount":0,"publisher":{"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"image":{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Function-Tutorial.jpg","keywords":["Arduino Core"],"articleSection":["Arduino","Embedded Systems","Embedded Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#respond"]}]},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/","url":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/","name":"Arduino delayMicroseconds() Function Tutorial","isPartOf":{"@id":"https:\/\/deepbluembedded.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Function-Tutorial.jpg","datePublished":"2023-04-24T07:24:35+00:00","dateModified":"2025-07-26T11:15:02+00:00","description":"Arduino delayMicroseconds() Function Tutorial. Arduino delayMicroseconds Accuracy Measurement, Timer, interrupt. Arduino Examples","breadcrumb":{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#breadcrumb"},"mainEntity":[{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1657575814713"},{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1657575939205"},{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1680065306913"},{"@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1680065383847"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#primaryimage","url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Function-Tutorial.jpg","contentUrl":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Function-Tutorial.jpg","width":1280,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/deepbluembedded.com\/"},{"@type":"ListItem","position":2,"name":"Arduino delayMicroseconds() Function Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/deepbluembedded.com\/#website","url":"https:\/\/deepbluembedded.com\/","name":"DeepBlueMbedded","description":"Embedded Systems And Computer Engineering Tutorials &amp; Articles","publisher":{"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/deepbluembedded.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/deepbluembedded.com\/#\/schema\/person\/30259d66cf68c6c681562dbe551b7867","name":"Khaled Magdy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g","caption":"Khaled Magdy"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/a8b5dc7385ec807e129b584974394d27e41c9979f3a2d0fd785b552b73529032?s=96&r=g"},"description":"Principal Embedded Systems Engineer with years of experience in embedded software and hardware design. I work in the Automotive &amp; e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI\/ML, and other fields I'm passionate about. I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?","sameAs":["https:\/\/deepbluembedded.com","https:\/\/www.facebook.com\/khaled.elrawy.359\/","https:\/\/www.instagram.com\/deepbluembedded\/","https:\/\/www.linkedin.com\/in\/khaled-magdy-\/","https:\/\/www.youtube.com\/channel\/UCzLSrNZD4rCjSCOVU9hknvA"]},{"@type":"Question","@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1657575814713","position":1,"url":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1657575814713","name":"Which timer does delayMicroseconds() use?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"The delayMicroseconds() function doesn't use a hardware timer, instead, it used the CPU clock cycles count. On the other hand, the [ delay() - micros() - millis() ] functions use Timer0 to work (this is for Arduino UNO, Mega, etc).","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1657575939205","position":2,"url":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1657575939205","name":"What is delayMicroseconds () in Arduino?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"The Arduino delayMicroseconds() function is a built-in function that pauses the CPU for a short time interval (in \u00b5s). Currently, the largest value that will produce an accurate delay is 16383. Larger values can produce an extremely short delay. For delays longer than a few thousand microseconds, you should use the\u00a0delay()\u00a0function instead.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1680065306913","position":3,"url":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1680065306913","name":"How accurate is Arduino delayMicroseconds?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"You can get down to 1\u00b5s time delay using the Arduino delayMicroseconds() function. It's pretty much accurate but you need to pay attention to the fact that any enabled interrupt can interfere with the operation of the delayMicroseconds function which is going to prolong the delay period. And potentially causing it to generate inconsistent time delay intervals. Creating a critical section around the delayMicroseconds function call will solve the issue but needs careful implementation.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1680065383847","position":4,"url":"https:\/\/deepbluembedded.com\/arduino-delaymicroseconds-function-tutorial\/#faq-question-1680065383847","name":"What is Arduino delayMicroseconds max value?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Currently, the largest value that will produce an accurate delay is 16383. Larger values can produce an extremely short delay. For delays longer than a few thousand microseconds, you should use the\u00a0delay()\u00a0function instead.","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"jetpack_featured_media_url":"https:\/\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-delayMicroseconds-Function-Tutorial.jpg","jetpack_shortlink":"https:\/\/wp.me\/p9SirL-2hO","jetpack-related-posts":[{"id":8757,"url":"https:\/\/deepbluembedded.com\/arduino-delay-function-tutorial\/","url_meta":{"origin":8792,"position":0},"title":"Arduino delay() Function Tutorial","author":"Khaled Magdy","date":"April 23, 2023","format":false,"excerpt":"In this tutorial, you'll learn how to use the Arduino delay function to add a time delay between events in your Arduino projects. We'll also discuss some variants of Arduino delay to achieve a time delay of (microsecond, millisecond, second, and 1 minute). Then, we'll discuss why you shouldn't always\u2026","rel":"","context":"In &quot;Arduino&quot;","block_context":{"text":"Arduino","link":"https:\/\/deepbluembedded.com\/embedded-systems\/embedded-tutorials\/arduino\/"},"img":{"alt_text":"Arduino Delay Function Tutorial","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Delay-Function-Tutorial.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Delay-Function-Tutorial.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Delay-Function-Tutorial.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Delay-Function-Tutorial.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/04\/Arduino-Delay-Function-Tutorial.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":9310,"url":"https:\/\/deepbluembedded.com\/arduino-micros\/","url_meta":{"origin":8792,"position":1},"title":"Arduino Micros() Function &#8211; (millis vs micros)","author":"Khaled Magdy","date":"May 5, 2023","format":false,"excerpt":"In this tutorial, we'll learn how to use the Arduino micros() function instead of delay. We'll discuss how the Arduino micros() function works and what are the use cases for it. And also the fundamental limitations of the micros() function and how to overcome the micros() overflow (rollover) issue in\u2026","rel":"","context":"In &quot;Arduino&quot;","block_context":{"text":"Arduino","link":"https:\/\/deepbluembedded.com\/embedded-systems\/embedded-tutorials\/arduino\/"},"img":{"alt_text":"Arduino Micros Tutorial","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Micros-Tutorial.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Micros-Tutorial.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Micros-Tutorial.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Micros-Tutorial.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Micros-Tutorial.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":9220,"url":"https:\/\/deepbluembedded.com\/arduino-led-dimmer\/","url_meta":{"origin":8792,"position":2},"title":"Arduino LED Dimmer (Potentiometer + PWM)","author":"Khaled Magdy","date":"May 2, 2023","format":false,"excerpt":"In this project tutorial, we'll create an Arduino LED Dimmer Project Using Potentiometer & PWM (analog output). You'll learn how PWM works, and how to create a LED Dimmer with Arduino controlled by a potentiometer. And we'll simulate and run the project code example to test its functionality. Without further\u2026","rel":"","context":"In &quot;Arduino Projects&quot;","block_context":{"text":"Arduino Projects","link":"https:\/\/deepbluembedded.com\/embedded-systems\/embedded-projects\/arduino-projects-category\/"},"img":{"alt_text":"Arduino LED Dimmer Project","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-LED-Dimmer-Project.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-LED-Dimmer-Project.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-LED-Dimmer-Project.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-LED-Dimmer-Project.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-LED-Dimmer-Project.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":11564,"url":"https:\/\/deepbluembedded.com\/arduino-electromagnet-control-circuit-code-example\/","url_meta":{"origin":8792,"position":3},"title":"Arduino Electromagnet Control (Tutorial &#038; Code Example)","author":"Khaled Magdy","date":"January 3, 2024","format":false,"excerpt":"In this tutorial, you'll learn how to do Arduino Electromagnet Control and use the Electromagnet Module with Arduino to turn it ON\/OFF and control the field strength. We'll also create an Arduino Electromagnet Example Project which can be a very good starting point for your Arduino + Electromagnet project idea.\u2026","rel":"","context":"In &quot;Arduino&quot;","block_context":{"text":"Arduino","link":"https:\/\/deepbluembedded.com\/embedded-systems\/embedded-tutorials\/arduino\/"},"img":{"alt_text":"Arduino Electromagnet Module Control Circuit Code Example","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/Arduino-Electromagnet-Module-Control-Circuit-Code-Example.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/Arduino-Electromagnet-Module-Control-Circuit-Code-Example.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/Arduino-Electromagnet-Module-Control-Circuit-Code-Example.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/Arduino-Electromagnet-Module-Control-Circuit-Code-Example.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2024\/01\/Arduino-Electromagnet-Module-Control-Circuit-Code-Example.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":9627,"url":"https:\/\/deepbluembedded.com\/arduino-nointerrupts-sei-cli-functions\/","url_meta":{"origin":8792,"position":4},"title":"Arduino noInterrupts, interrupts, sei() &#038; cli() Functions","author":"Khaled Magdy","date":"May 18, 2023","format":false,"excerpt":"In this tutorial, we'll learn how to use the Arduino noInterrupts() function and sei() & cli() macros to control global interrupts enable\/disable. We'll discuss how to create critical sections in the Arduino code using this feature and why you shouldn't use it excessively throughout your project. Without further ado, let's\u2026","rel":"","context":"In &quot;Arduino&quot;","block_context":{"text":"Arduino","link":"https:\/\/deepbluembedded.com\/embedded-systems\/embedded-tutorials\/arduino\/"},"img":{"alt_text":"Arduino noInterrupts() sei() cli() Function","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-noInterrupts-sei-cli-Function.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-noInterrupts-sei-cli-Function.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-noInterrupts-sei-cli-Function.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-noInterrupts-sei-cli-Function.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-noInterrupts-sei-cli-Function.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":9683,"url":"https:\/\/deepbluembedded.com\/arduino-software-interrupts\/","url_meta":{"origin":8792,"position":5},"title":"Arduino Software Interrupts","author":"Khaled Magdy","date":"May 18, 2023","format":false,"excerpt":"In this tutorial, we'll discuss Arduino Software Interrupts and how to generate a software interrupt (trap) in Arduino. We'll implement an Arduino Software Interrupt Example project to test what we'll learn throughout this tutorial. Without further ado, let's get right into it! Software Interrupts Software interrupts are interrupt signals that\u2026","rel":"","context":"In &quot;Arduino&quot;","block_context":{"text":"Arduino","link":"https:\/\/deepbluembedded.com\/embedded-systems\/embedded-tutorials\/arduino\/"},"img":{"alt_text":"Arduino Software Interrupts","src":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Software-Interrupts.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Software-Interrupts.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Software-Interrupts.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Software-Interrupts.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/deepbluembedded.com\/wp-content\/uploads\/2023\/05\/Arduino-Software-Interrupts.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/8792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/comments?post=8792"}],"version-history":[{"count":9,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/8792\/revisions"}],"predecessor-version":[{"id":14155,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/posts\/8792\/revisions\/14155"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/media\/8806"}],"wp:attachment":[{"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/media?parent=8792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/categories?post=8792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/deepbluembedded.com\/wp-json\/wp\/v2\/tags?post=8792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}