how can you do an analog write to a digital output

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • victor hill

    #1

    how can you do an analog write to a digital output

    I am working with an Arduino board that uses C programming. I tried to program an analog fade program to an LED on an analog pin...it just flashed. I then used analog programming code and sent it to a digital pin. Why does this work???
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    What do you mean by "analog programming code"?

    Are you trying to adjust the brightness of an LED? An LED is basically either on or off, it doesn't support different brightness levels. It is customary to accomplish the appearance of adjustable brightness through pulse-width modulation (PWM). That is, the LED is turned on and off at a sufficiently high frequency that the human eye doesn't perceive the flicker. The apparent brightness of the LED can be adjusted by varying the duty cycle of the PWM signal. Notice that PWM can be accomplished with a digital output.

    Comment

    Working...