Today I learned you can use generic GPIO PWM to fake an analog voltage.
https://ww1.microchip.com/downloads/en/Appnotes/90003250A.pd...
Congrats, you're one of today's lucky 10000! It's extremely common actually. I don't know if they're still doing it but Raspberry Pi 1,2,3 had only PWM audio output, not true analog.
A PWM output followed by an adequate filter can be considered a cheap, low quality type of DAC. You never get the quality as good as you want but you get it good enough.
Working in process control, this is an everyday thing for me. But I prefer to use pulse frequency modulation, which is what a lot of dedicated DACs use.
This is also how Arduino emulates analog output, since most micros don’t have a hardware DAC
https://docs.arduino.cc/language-reference/en/functions/anal...