EasyManua.ls Logo

Eckstein komponente KS0530 - Page 95

Default Icon
160 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
95
We know that digital port only has two state of 0 and 1. So how to send an
analog value to a digital value? Here,this function is needed. Lets observe
the Arduino board and find 6 pins marked~which can output PWM
signals.
Function format as follows:
analogWrite(pin,value)
analogWrite() is used to write an analog value from 0~255 for PWM port,
so the value is in the range of 0~255. Attention that you only write the
digital pins with PWM function, such as pin 2 , 34 , 567 , 8 , 910
11 , 12 , 13 , 44 , 45 , 46.
PWM is a technology to obtain analog quantity through digital method.
Digital control forms a square wave, and the square wave signal only has
two states of turning on and off (that is, high or low levels). By controlling
the ratio of the duration of turning on and off, a voltage varying from 0 to
5V can be simulated. The time turning on(academically referred to as high
level) is called pulse width, so PWM is also called pulse width modulation.
Through the following five square waves, lets acknowledge more about
PWM.