DAC is an output not an input. There is no DAC on the propshield. Connect T3.2 DAC/A14 to AudioIn on propshield to have T3.2 generate sounds/sinewave out DAC to AudioIn ... to speaker on propshield. See schematic
https://www.pjrc.com/store/prop_shield.html
if you have propshield mounted on top of T3.2, the DAC and AudioIn pin/holes are right above each other.
Here is simple sketch to generate sine wave on T3.2 DAC, hook DAC to propshield AudioIn and listen to tone on propshield speaker.
Code:
float phase = 0.0;
float twopi = 3.14159 * 2;
elapsedMicros usec = 0;
void setup() {
analogWriteResolution(12);
}
void loop() {
float val = sinf(phase) * 2048.0 + 2048.0;
analogWrite(A14, (int)val);
phase = phase + 0.02;
if (phase >= twopi) phase = 0;
while (usec < 500) ; // wait
usec = usec - 500;
}
Don't forget digitalWrite(5,HIGH); to enable amp on propshield.
or use the Audio library to drive DAC
Code:
// prop shield need pin 5
// start monitor to hear sound, hit key to increase freq
#include <Audio.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveformSine sine1; //xy=180,469
AudioOutputAnalog dac1; //xy=380,468
AudioConnection patchCord1(sine1, dac1);
// GUItool: end automatically generated code
int freq = 1100;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("Setting up");
//dac1.analogReference(EXTERNAL); // louder, default is 1.2v INTERNAL
pinMode(5, OUTPUT);
digitalWrite(5, 1);//Enable Amplifier.
AudioMemory(12);
sine1.amplitude(1.0);
sine1.frequency(1000);
Serial.println("Send Serial Char to increase freq");
}
void loop()
{
if (Serial.available()) {
Serial.read();
sine1.frequency(freq);
Serial.println(freq);
freq += 100;
}
}