The analogWrite() function is used to generate a PWM (Pulse Width Modulation) output signal on compatible pins.

The analogWrite() function is part of the standard Arduino library. It does not allow true digital-to-analog conversion. Rather, it generates a PWM (Pulse Width Modulation) output signal on any compatible pin.

It has the following syntax:

analogWrite(pin, value);

The first parameter identifies the IO pin number to generate the signal on. The second parameter should be in the range 0-255, and specifies the duty cycle to use (0 is 'always off', 255 is 'always on').

Full documentation is available online here:

Note: Please only use this tag for questions which are specific to the analogWrite() function. For questions about PWM in general, please use the tag.