同前篇,英文部分來源為官網頁面

為Microcontroller中,4個部分的第3部分

參考連結:https://www.arduino.cc/en/Tutorial/Foundations

========

PWM  脈衝寬度調變 (Wiki

  The Fading example demonstrates the use of analog output (PWM) to fade an LED. It is available in the File->Sketchbook->Examples->Analog menu of the Arduino software.

 

  範例 "The Fading " 展示了使用類比輸出(PWM)來使LED變暗。可從Arduino 軟體目錄中取得,路徑為: File->Sketchbook->Examples->Analog

 

 

  Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off. This on-off pattern can simulate voltages in between full on (5 Volts) and off (0 Volts) by changing the portion of the time the signal spends on versus the time that the signal spends off. The duration of "on time" is called the pulse width. To get varying analog values, you change, or modulate, that pulse width. If you repeat this on-off pattern fast enough with an LED for example, the result is as if the signal is a steady voltage between 0 and 5v controlling the brightness of the LED.

 

  脈衝寬度調變(Pulse Width Modulation,PWM),是一種以數位方式得到類比結果的技術。

  數位控制被用來製造方波(square wave)---一種在開與關間切換的訊號。

  這種『開-關』模式,能夠藉由改變『開(on)』與『關(off)』的時間比例,模擬介於完全開(5V)與關(0V)之間的電壓。

  『開(on)』的時間長度被稱為脈衝寬度。要得到改變的類比值,你需要改變---或調變(modulate)--脈衝寬度。

  以LED為例,如果你夠快地重複這種『開 - 關』模式,結果會是彷彿訊號是一個穩定界於0到5V的電壓,控制了LED的亮度。

 

 

 

  In the graphic below, the green lines represent a regular time period. This duration or period is the inverse of the PWM frequency. In other words, with Arduino's PWM frequency at about 500Hz, the green lines would measure 2 milliseconds each. A call to analogWrite() is on a scale of 0 - 255, such that analogWrite(255) requests a 100% duty cycle (always on), and analogWrite(127) is a 50% duty cycle (on half the time) for example.

 

  在下方的圖中,綠色線代表一個規律的時間週期(a regular time period)。

  『時間長度(duration)』或『週期(period)』是PWM頻率的倒數。

  換句話說,在Arduino的PWM頻率位於500Hz時,每根綠色線條量起來會是2毫秒(milliseconds)。

  呼叫 analogWrite() 是介於 0-255 的刻度之間,所以,舉例來說, analogWrite(255) 會請求100%(永遠是開)的工作週期(duty cycle),而 analogWrite(127) 是50% 的 工作週期(一半的時間是「開」)。

 

 

  Once you get this example running, grab your arduino and shake it back and forth. What you are doing here is essentially mapping time across the space. To our eyes, the movement blurs each LED blink into a line. As the LED fades in and out, those little lines will grow and shrink in length. Now you are seeing the pulse width.

 

  一旦你執行了這個例子(應該是指Arduino內附的程式碼"The Fading"),把你的Arduino板抓起來前後搖一搖。

  你在做的事,本質上就是在空間中映射出時間(有點難翻,*#$U(*)@)。

  對我們的眼睛來說,這個動作把每個LED的閃爍模糊成一條線(blurs each LED blink into a line)。

  當LED燈淡入淡出,這些小線條會在長度上成長以及緊縮。(編按:照著翻出來,但自己也看不太懂?_?)

  現在你就看到脈衝寬度了。

 

Written by Timothy Hirzel

 

 

 

 

 

 

arrow
arrow
    文章標籤
    PWM Arduino 翻譯 foundation
    全站熱搜

    迷途工程師 發表在 痞客邦 留言(0) 人氣()