In MEGA 2560, making triangular waves over 300kHz

I want to make a triangular waveform for sine modulation.

I made high frequency PWM.
Sine modulating need high frequency triangular wave.
When I searched, I couldn't see how to make a high-frequency triangular wave.
[But i got 100Khz PWM in forum. :slight_smile: ]

Do you know how to code it?

I'm pretty sure making any decent triangular wave is beyond the Mega's capability without additional hardware.

then what hardware should I use?

Use something based on a 16MHz crystal - first generate a square wave using it and then a filter to convert it to triangular/sawtooth.

Note that you will need high-speed components and proper circuit layout.

You might start researching op-amp integrator circuits.

All right. I'll try.

This should be possible using DDS on the arduino with an RC integrator on the output. So you'd only need two additional components.

Google arduino dds and you should find plenty to get you started.