GPIO 5V and 3V AC or DC

Is there an option or something?

Can you please elaborate?
IIRC, GPIO pins

  • can output 0, 3.3 or high impedance (tristate)
  • can withstand 0 to 5v (the STM32 datasheet has a lot of specifics)
  • are ADC capable
  • are not DAC capable, but PWM is an option for some uses

The power pins are DC only. You could simulate square half wave AC on a GPIO pin but I don’t think you could get a pure sine wave without additional hardware. I don’t think you can simulate square full wave without extra hardware but someone might correct me on that.

Your question is unique so I’d love to hear your idea.