Post #22 gives me the 4 channels as I need, now I need to regulate amplitude sine channel, whatever I do the amplitude is not changing.
This part of code
This part of code
HTML Code:
void generateWaveforms() {
for (int i = 0; i < WAVEFORM_SAMPLES; i++) {
// wave_data1[i] = (uint8_t)((255 * i) / WAVEFORM_SAMPLES);
wave_data1[i] = (uint8_t)( (50 + cos(2 * 3.14159 * i / WAVEFORM_SAMPLES)));
wave_data2[i] = (uint8_t)(127.5 * (1 + sin(2 * 3.14159 * i / WAVEFORM_SAMPLES)));
// int dutyCycle = (int)(amp + amp * sin(stp * i)); // Calculate the duty cycle
}
for (int i = 0; i < WAVEFORM_SAMPLES; i++) {
stereo_buffer[i * 2] = wave_data1[i]; // DAC1
stereo_buffer[i * 2 + 1] = wave_data2[i]; // DAC2
}
}

Comment