You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int outPin = 8; // digital pin 8
void setup()
{
pinMode(outPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
digitalWrite(outPin, HIGH); // sets the pin on
delayMicroseconds(50); // pauses for 50 microseconds
digitalWrite(outPin, LOW); // sets the pin off
delayMicroseconds(50); // pauses for 50 microseconds
}
configures pin number 8 to work as an output pin. It sends a train of pulses with 100 microseconds period.
on my Arduino UNO R3 and Arduino 1.0.6, the signal observed on pin 8 was approximately 9207Hz.
It means that the period is approximately 108.6 microseconds, and I think this error is caused due to the execution time of instructions other than delayMicroseconds() (i.e. digitalWrite() and the loop).
From this test, we can say that the sample do not send a train of pulses with 100 microseconds period but sends a train of pulses with approximately 100 microseconds period.
I think this explanation on the reference is a little bit misleading.
The problem becomes bigger when I change the delay from 50 microseconds to 5 microeconds: the output was approximately 55566Hz instead of expected 100kHz.
The text was updated successfully, but these errors were encountered:
When I executed the example on the reference of delayMicroseconds()(WebArchive)
on my Arduino UNO R3 and Arduino 1.0.6, the signal observed on pin 8 was approximately 9207Hz.
It means that the period is approximately 108.6 microseconds, and I think this error is caused due to the execution time of instructions other than
delayMicroseconds()
(i.e.digitalWrite()
and the loop).From this test, we can say that the sample do not send a train of pulses with 100 microseconds period but sends a train of pulses with approximately 100 microseconds period.
I think this explanation on the reference is a little bit misleading.
The problem becomes bigger when I change the delay from 50 microseconds to 5 microeconds: the output was approximately 55566Hz instead of expected 100kHz.
The text was updated successfully, but these errors were encountered: