Boo0ns / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Add a noAnalogWrite() function to disable PWM on a pin. #476

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What change would like to see?

A noAnalogWrite() function that turns off PWM on a pin (so you can use it for 
normal digital input and output).

Why?

The new digitalWrite(), digitalRead(), and pinMode() in 1.0 don't disable PWM, 
so there needs to be a way to do it explicitly.  So you'd do something like:

analogWrite(9, 128);
delay(1000);
noAnalogWrite(9);
digitalWrite(9, HIGH);

An alternative would be to disable PWM in pinMode(), but I don't like the 
asymmetry of:

analogWrite(9, 128);
delay(1000);
pinMode(9, OUTPUT);
digitalWrite(9, HIGH);

Original issue reported on code.google.com by dmel...@gmail.com on 12 Feb 2011 at 7:05

GoogleCodeExporter commented 9 years ago
https://github.com/arduino/Arduino/commit/38d4a34fec6925b29a732d13e200f54ee4b420
25

Original comment by dmel...@gmail.com on 12 Feb 2011 at 7:49

GoogleCodeExporter commented 9 years ago
This got reverted later.

Original comment by dmel...@gmail.com on 24 Aug 2011 at 6:42