Difference between analogWrite and digitalWrite

Thread Starter

brave_guy

Joined Sep 11, 2014
3
Hi People,

Can somebody tell me how "analogWrite" differ from "DigitalWrite" ? In which circumstances should we pick one of them if it makes too much difference?

Thanks,
Brave_Guy
 

sirch2

Joined Jan 21, 2013
1,037
I take it you are talking about Arduino analogWrite?

If so I'll save you the trouble of just Googling it and tell you that they are very different, so just use digitalWrite unless you know that you really need analogWrite. analogWrite sends a pulsed output via the PWM pins and so can be used to dim an LED or passed through a filter to produce a voltage other than the digital high voltage.
 

tshuck

Joined Oct 18, 2012
3,534
It would be good if you mentioned that this is for an Arduino, as some may be confused with undefined language such as "digitalWrite".

With that said, the Arduino website helps and is the first result when searching for those exact terms:
As you can see from the documentation, analogWrite is a Pulse-Width Modulated (PWM) signal, where digitalWrite produces a constant HIGH or LOW.
 

Thread Starter

brave_guy

Joined Sep 11, 2014
3
Dear tshuck and sirch2,
As you guessed, the question was for Arduino.
I think I understood now.

I take it you are talking about Arduino analogWrite?

If so I'll save you the trouble of just Googling it and tell you that they are very different, so just use digitalWrite unless you know that you really need analogWrite. analogWrite sends a pulsed output via the PWM pins and so can be used to dim an LED or passed through a filter to produce a voltage other than the digital high voltage.
It would be good if you mentioned that this is for an Arduino, as some may be confused with undefined language such as "digitalWrite".

With that said, the Arduino website helps and is the first result when searching for those exact terms:
As you can see from the documentation, analogWrite is a Pulse-Width Modulated (PWM) signal, where digitalWrite produces a constant HIGH or LOW.
 
From my point of view
digitalwrite doesn't offer the chance of playing around with the volts that reach the component, meaning the amount of volts released from the arduino are the exact volts that will reach the component while analogwrite helps you to control the amount of volts reaching the component.
 
Top