Pages: [1]   Go Down
Author Topic: AnalogWrite  (Read 576 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just a weird questions

When using PWM you use the analogwrite command.  Anyone know why they chose analogwrite, because technically PWM is still digital.  It's just turning on and off really fast.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 175
---
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From a high level perspective, does it not appear to you that you are actually controlling the analog voltage output on that pin?

To your mother (who I presume won't understand this stuff), analogWrite appears to simply write an analog voltage on that pin. She doesn't know what PWM is and she doesn't even care.
Logged

Boston, MA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1024
wiblocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you filter the PWM signal with a capacitor you will get an analog value.
One of the features missing from the ATmega168/328 is a DAC. Doing a
PWM DAC is a reasonable compromise.

(* jcl *)

------------------------------------
www: http://www.wiblocks.com
twitter: http://twitter.com/wiblocks
blog: http://luciani.org

Logged


Manchester (England England)
Online Online
Brattain Member
*****
Karma: 509
Posts: 31478
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For a more detailed explanation see:-
http://www.thebox.myzen.co.uk/Tutorial/PWM.html
Logged

Pages: [1]   Go Up
Jump to: