소스 검색

Remove debugging statement from AudioToneSweep and add ToneSweep example sketch

dds
Pete (El Supremo) 10 년 전
부모
커밋
dd1c6bdb72
2개의 변경된 파일88개의 추가작업 그리고 1개의 파일을 삭제
  1. +0
    -1
      Audio.cpp
  2. +88
    -0
      examples/ToneSweep/ToneSweep.ino

+ 0
- 1
Audio.cpp 파일 보기

@@ -3692,6 +3692,5 @@ void AudioToneSweep::update(void)
// send the samples to the left channel
transmit(block,0);
release(block);
if(!sweep_busy)Serial.println(b_count);
}
}

+ 88
- 0
examples/ToneSweep/ToneSweep.ino 파일 보기

@@ -0,0 +1,88 @@
/*
Demo of the audio sweep function.
The user specifies the amplitude,
start and end frequencies (which can sweep up or down)
and the length of time of the sweep.
FMI:
The audio board uses the following pins.
6 - MEMCS
7 - MOSI
9 - BCLK
10 - SDCS
11 - MCLK
12 - MISO
13 - RX
14 - SCLK
15 - VOL
18 - SDA
19 - SCL
22 - TX
23 - LRCLK

*/

#include <arm_math.h>
#include <Audio.h>
#include <Wire.h>
//#include <WM8731.h>
#include <SD.h>
#include <SPI.h>
#include <Bounce.h>

AudioToneSweep myEffect;
AudioOutputI2S audioOutput; // audio shield: headphones & line-out

// The tone sweep goes to left and right channels
AudioConnection c1(myEffect, 0, audioOutput, 0);
AudioConnection c2(myEffect, 0, audioOutput, 1);

AudioControlSGTL5000 audioShield;


int t_ampx = 20000;
int t_lox = 10;
int t_hix = 22000;
// Length of time for the sweep in seconds
float t_timex = 10;
// <<<<<<<<<<<<<<>>>>>>>>>>>>>>>>
void setup(void)
{
Serial.begin(9600);
while (!Serial) ;
delay(3000);

AudioMemory(2);

audioShield.enable();
audioShield.volume(50);
// I want output on the line out too
audioShield.unmuteLineout();
// audioShield.muteHeadphone();

Serial.println("setup done");

if(!myEffect.begin(t_ampx,t_lox,t_hix,t_timex)) {
Serial.println("AudioToneSweep - begin failed");
while(1);
}
// wait for the sweep to end
while(myEffect.busy());

// and now reverse the sweep
if(!myEffect.begin(t_ampx,t_hix,t_lox,t_timex)) {
Serial.println("AudioToneSweep - begin failed");
while(1);
}
// wait for the sweep to end
while(myEffect.busy());
Serial.println("Done");
}

void loop(void)
{
}




Loading…
취소
저장