Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: simple tone in 3.5

  1. #1
    Junior Member
    Join Date
    Jun 2021
    Posts
    2

    simple tone in 3.5

    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));
    }

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,472
    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.

  3. #3
    Junior Member
    Join Date
    Jun 2021
    Posts
    2
    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... "

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •