Computing stuff tied to the physical world

Docs » Port anaWrite()


SYNOPSIS


#include <Ports.h>


Port port (1);


void port.anaWrite(byte value);


DESCRIPTION


Set up the DIO (not AIO!) pin to generate a pulsed signal with a duty cycle as specified by the argument.


This doesn't actually generate an analog output but a pulse-width modulated digital signal. For many purposes such as LEDs and motor speed control, this has essentially the same effect though. To actually generate a varying voltage level, an RC network will have to be attached to the DIO pin.


PARAMETERS


value

The duty cycle of the output signal, from 0 =  fully off (0%) to 255 = fully on (100%).


NOTES


With an ATmega168 / ATmega328, this function will only generate a PWM signal on ports 2 and 3.


This is a thin wrapper around the Arduino analogWrite() function.


SEE ALSO


Other member function in class Port, which is part of the Ports library.


page index