The analogWrite function has nothing to do with the analog pins or the analogRead function. Older Arduino boards with an ATmega8 only support analogWrite() on pins 9, 10, and 11. On the Arduino Mega, it works on pins 2 through 13. You do not need to call pinMode() to set the pin as an output before calling analogWrite(). From the arduino reference on analogWrite function: On most Arduino boards (those with the ATmega168 or ATmega328), this function works on pins 3, 5, 6, 9, 10, and 11. ** In addition to PWM capabilities on the pins noted above, the Due has true analog output when using analogWrite() on pins DAC0 and DAC1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |