4.4 Experiment and code
This experimental schematic is very simple, and similar to the example one. Note that, the port connected with LED must be one of the ports 3,5,6,9,10,11 on Arduino board. Certainly, if you use other method, it is maybe different. Its schematic and circuits can be seen in Figure 4-4, 4-5.
Figure 4-4 Experimental schematic
Figure 4-5 Experimental circuit
01 / Program 4: Arduino and PWM for continuous variations from bright to dim for LED
4.5 Key points to summarize
1) Although digital signal is superior than analog signal. But in some applications, it is a must to use analog signal, like motor, music, and so on.
2) The scope of parameter “value” in the Arduino sentence analogWrite(pin,value) is 0~255. We should understand the relationships between duty cycle and the output voltage.
3) There are two kinds of ports on the Arduino board, in which, only some ports can be used to output the analog signal.