simple tone in 3.5

Status
Not open for further replies.

m.magrini

New member
Hello, I am a new user.

I am just trying a very basic example, a sine tone, on my 3.5 using internal DACs.
I connected an amplifier to DAC0 (I am not sure if I should use GND or Analog GND... anyway) but I don't hear anything.
The board is working because I can read a pot (connected on A9) value correctly.
Any suggestions?




The code:

#include <Audio.h>


// GUItool: begin automatically generated code
AudioSynthWaveformSine sine1; //xy=241,1124
AudioOutputAnalogStereo dacs1; //xy=541,1329
AudioConnection patchCord1(sine1, 0, dacs1, 0);
AudioConnection patchCord2(sine1, 0, dacs1, 1);
// GUItool: end automatically generated code


void setup() {
// put your setup code here, to run once:
sine1.frequency(440);
sine1.amplitude(0.75);
Serial.begin(9600);
}

void loop()
Serial.println(analogRead(A9));
}
 
You're missing AudioMemory(). Without that line to allocate memory, the audio library can't do anything.

In Arduino, click File > Examples > Audio to open any of the examples.
 
OK. thanks a lot!

Maybe this part in the documentation should be improved a little bit, especially for newbies.... ;-)

"TODO: an example showing varying memory usage... "
 
Status
Not open for further replies.
Back
Top