Hi to everybody,
I'm trying to do a waveform generator for my physics course with arduino due, but I found a problem, when I try to compile, the IDE said me that t_sample isn't defined at the loop section, and indeed is it, I tried to put just Sample and it compiled, but I don't know if is ok or if they have a mistake there.
// Read the the potentiometer and map the value between the maximum and the minimum sample available
// 1 Hz is the minimum freq for the complete wave
// 170 Hz is the maximum freq for the complete wave. Measured considering the loop and the analogRead() time
sample = map(analogRead(A0), 0, 4095, 0, oneHzSample);
sample = constrain(t_sample, 0, oneHzSample);
analogWrite(DAC0, waveformsTable[wave0]); // write the selected waveform on DAC0
analogWrite(DAC1, waveformsTable[wave1]); // write the selected waveform on DAC1
if(i == maxSamplesNum) // Reset the counter to repeat the wave
i = 0;
delayMicroseconds(sample); // Hold the sample value for the sample time
Note: I haven't a oscilloscope to test it :/.
Too many thanks