You guys are going to laugh at me... I found out that red LED I had was one of those self-blinking ones - hence why the frequency was stuck!
I took defragster's advice and wired the dac0 and dac1 to A0 and A1, respectively. I also removed all other wires / LED.
This program creates the output below (which looks wrong to me):
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveformSine sine1; //xy=236,269
//AudioSynthWaveformSine sine2; //xy=247,377
AudioOutputAnalog dac1; //xy=406,263
//AudioOutputAnalog dac2; //xy=424,389
AudioConnection patchCord1(sine1, dac1);
//AudioConnection patchCord2(sine2, dac2);
// GUItool: end automatically generated code
void setup() {
Serial.println("hi");
sine1.frequency(1);
sine1.amplitude(1.0);
// sine2.frequency(1);
// sine2.amplitude(1.0);
}
void loop() {
int val0 = analogRead(0);
int val1 = analogRead(1);
Serial.printf("A0: %d A1: %d\n", val0, val1);
delay(100);
}
Code:
23:47:51.924 -> hi
23:47:51.924 -> A0: 184 A1: 558
23:47:51.924 -> A0: 184 A1: 442
23:47:51.924 -> A0: 184 A1: 366
23:47:51.956 -> A0: 184 A1: 394
23:47:52.066 -> A0: 184 A1: 390
23:47:52.176 -> A0: 184 A1: 413
23:47:52.249 -> A0: 184 A1: 396
23:47:52.358 -> A0: 184 A1: 368
23:47:52.471 -> A0: 184 A1: 387
23:47:52.584 -> A0: 184 A1: 410
23:47:52.657 -> A0: 184 A1: 425
23:47:52.769 -> A0: 184 A1: 404
23:47:52.881 -> A0: 184 A1: 391
23:47:52.956 -> A0: 184 A1: 388
23:47:53.065 -> A0: 184 A1: 423
23:47:53.177 -> A0: 184 A1: 414
23:47:53.252 -> A0: 184 A1: 378
23:47:53.364 -> A0: 184 A1: 373
23:47:53.476 -> A0: 184 A1: 405
23:47:53.552 -> A0: 184 A1: 384
23:47:53.665 -> A0: 184 A1: 416
23:47:53.775 -> A0: 184 A1: 418
23:47:53.848 -> A0: 184 A1: 442
23:47:53.959 -> A0: 184 A1: 395
23:47:54.065 -> A0: 184 A1: 428
23:47:54.176 -> A0: 184 A1: 388
23:47:54.283 -> A0: 184 A1: 410
23:47:54.350 -> A0: 184 A1: 410
23:47:54.456 -> A0: 184 A1: 433
23:47:54.566 -> A0: 184 A1: 446
23:47:54.676 -> A0: 184 A1: 427
23:47:54.749 -> A0: 184 A1: 425
23:47:54.855 -> A0: 184 A1: 380
23:47:54.968 -> A0: 184 A1: 402
This program, compiles, but does not run:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveformSine sine1; //xy=236,269
AudioSynthWaveformSine sine2; //xy=247,377
AudioOutputAnalog dac1; //xy=406,263
AudioOutputAnalog dac2; //xy=424,389
AudioConnection patchCord1(sine1, dac1);
AudioConnection patchCord2(sine2, dac2);
// GUItool: end automatically generated code
void setup() {
Serial.println("hi");
sine1.frequency(1);
sine1.amplitude(1.0);
sine2.frequency(1);
sine2.amplitude(1.0);
}
void loop() {
int val0 = analogRead(0);
int val1 = analogRead(1);
Serial.printf("A0: %d A1: %d\n", val0, val1);
delay(100);
}
So I'm guessing I'm screwed at this point?
One thing I'm confused about is how the GUI generated code associates the variables 'dac1' and 'dac2' to the actual hardware, as I can name these 'dacblahblah' if I want... I see no other identifiers in the generated code.