1 Reply Latest reply on Nov 30, 2014 10:09 PM by mmi

    Some question about delayMicroseconds()

    new_man

      I tested the arduino function  delayMicroseconds() in the following program on Edison arduino board. I want produce a square wave of T=400us and duty=50%.

      But I got a square wave of T=600us and duty=50%. I watched the wave on an oscilloscope.

      Why? And how can i get a accurate delay of us?

       

      void setup() {

        // put your setup code here, to run once:

        pinMode(12,OUTPUT);

      }

       

       

      void loop() {

        // put your main code here, to run repeatedly:

       

        digitalWrite(12,LOW);

        delayMicroseconds(200);

        digitalWrite(12,HIGH);

        delayMicroseconds(200);

       

      }