Digital to Analog Converter

Note: Very few pins (usually only 2) are capable of Analog Output, and some boards don't have any. See the Reference for your board and look for DAC.

Analog outputs are easy to write in Espruino:

analogWrite(A4, 0.5)

This writes an analog value to A4, which should be 0.5*3.3v = 1.65v

Note that if you use analogWrite on a pin that is not capable of analog outputs but that can handle PWM, Espruino will automatically use PWM to create an analog value on that pin instead.

Using Analog Outputs

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.