Show Posts
Pages: 1 ... 414 415 [416]
6226  Forum 2005-2010 (read only) / Uno Punto Zero / Re: It is brilliant - lock it down. on: February 25, 2010, 06:03:59 pm
It's certainly a valid point of view. But as a number if beginners have noticed, analogWrite is not a  very good simulation of analog output if you try to read the output from analogWrite on another arduino using analogRead (or anything else that needs a true analog signal).

The simplification would be less troublesome if analogWrite did not have significant differences from the way analogRead is used.
6227  Forum 2005-2010 (read only) / Uno Punto Zero / Re: It is brilliant - lock it down. on: February 25, 2010, 03:13:36 pm
Quote
is the compiler smart enough to know what to do to eliminate this?
Yes, the compiler is smart enough not to include code that is not called, so a duplicated function with a different name would not add any overhead (assuming only one of the function names was called in a sketch).  

analogWrite may sound like a nice intuitive name but its not really very helpful because its behaviour appears odd to people that don't understand why only certain pins can be used, and only if some other library is not using them, and with values that have a different range from analogRead.

I have seen many non-technical people come unstuck when introduced to  analogWrite because they expect it to be similar to analogRead - in the same way as digitalWrite is similar to digitalRead.  

There is so much code out there using analogWrite that this should continue to be supported. But I expect many non-technical people would prefer to be introduced to a new function named something like pwmWrite that is clearly explained, rather than glancing at analogWrite and expecting it to behave like an output version of analogRead.
Pages: 1 ... 414 415 [416]