“DelayMicroseconds(us)”的版本間的差異
來自ALSROBOT WiKi
(以“<pre style="color:blue"> void delayMicroseconds (unsigned int us) </pre> 延時(shí)(微秒) <br> 延時(shí), 單位為微妙(1毫秒有1000微妙). 如果延時(shí)的時(shí)間...”為內(nèi)容創(chuàng)建頁面) |
2014年9月12日 (五) 16:29的最后版本
void delayMicroseconds (unsigned int us)
延時(shí)(微秒)
延時(shí), 單位為微妙(1毫秒有1000微妙). 如果延時(shí)的時(shí)間有幾千微妙, 那么建議使用 delay 函數(shù). 目前參數(shù)最大支持16383微妙(不過以后的版本中可能會(huì)變化).
以下代碼向第8號(hào)引腳發(fā)送脈沖, 每次脈沖持續(xù)50微妙的時(shí)間.
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 }