PaulStoffregen 10 роки тому
джерело
коміт
0891e07bac
4 змінених файлів з 68 додано та 50 видалено
  1. +13
    -11
      examples/Analysis/DialTone_7segment/DialTone_7segment.ino
  2. +26
    -14
      examples/Analysis/DialTone_Serial/DialTone_Serial.ino
  3. +7
    -1
      examples/HardwareTesting/PassThroughMono/PassThroughMono.ino
  4. +22
    -24
      examples/HardwareTesting/PassThroughStereo/PassThroughStereo.ino

+ 13
- 11
examples/Analysis/DialTone_7segment/DialTone_7segment.ino Переглянути файл

@@ -1,8 +1,10 @@
// Dial Tone (DTMF) decoding example.
//
// The audio with dial tones is connected to analog input A0,
// The audio with dial tones is connected to analog input A2,
// without using the audio shield. See the "DialTone_DTMF"
// example for using the audio shield.
//
// This example code is in the public domain.

#include <Audio.h>
#include <Wire.h>
@@ -12,7 +14,7 @@
// Create the Audio components. These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
AudioInputAnalog audioIn(A0);
AudioInputAnalog audioIn;
AudioAnalyzeToneDetect row1; // 7 tone detectors are needed
AudioAnalyzeToneDetect row2; // to receive DTMF dial tones
AudioAnalyzeToneDetect row3;
@@ -23,21 +25,21 @@ AudioAnalyzeToneDetect column3;

// Create Audio connections between the components
//
AudioConnection c01(audioIn, 0, row1, 0);
AudioConnection c02(audioIn, 0, row2, 0);
AudioConnection c03(audioIn, 0, row3, 0);
AudioConnection c04(audioIn, 0, row4, 0);
AudioConnection c05(audioIn, 0, column1, 0);
AudioConnection c06(audioIn, 0, column2, 0);
AudioConnection c07(audioIn, 0, column3, 0);
AudioConnection patchCord1(audioIn, 0, row1, 0);
AudioConnection patchCord2(audioIn, 0, row2, 0);
AudioConnection patchCord3(audioIn, 0, row3, 0);
AudioConnection patchCord4(audioIn, 0, row4, 0);
AudioConnection patchCord5(audioIn, 0, column1, 0);
AudioConnection patchCord6(audioIn, 0, column2, 0);
AudioConnection patchCord7(audioIn, 0, column3, 0);

// pins where the 7 segment LEDs are connected
const int sevenseg_a = 17; // aaa
const int sevenseg_b = 9; // f b
const int sevenseg_c = 11; // f b
const int sevenseg_d = 12; // ggg
const int sevenseg_e = 15; // e c
const int sevenseg_f = 16; // e c
const int sevenseg_e = 14; // e c
const int sevenseg_f = 15; // e c
const int sevenseg_g = 10; // ddd



+ 26
- 14
examples/Analysis/DialTone_Serial/DialTone_Serial.ino Переглянути файл

@@ -1,3 +1,15 @@
// Dial Tone (DTMF) decoding example.
//
// The audio with dial tones is connected to audio shield
// Left Line-In pin. Dial tone output is produced on the
// Line-Out and headphones.
//
// Use the Arduino Serial Monitor to watch for incoming
// dial tones, and to send digits to be played as dial tones.
//
// This example code is in the public domain.


#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
@@ -14,24 +26,24 @@ AudioAnalyzeToneDetect row4;
AudioAnalyzeToneDetect column1;
AudioAnalyzeToneDetect column2;
AudioAnalyzeToneDetect column3;
AudioSynthWaveform sine1(AudioWaveformSine); // 2 sine wave
AudioSynthWaveform sine2(AudioWaveformSine); // to create DTMF
AudioSynthWaveformSine sine1; // 2 sine wave
AudioSynthWaveformSine sine2; // to create DTMF
AudioMixer4 mixer;
AudioOutputI2S audioOut;

// Create Audio connections between the components
//
AudioConnection c01(audioIn, 0, row1, 0);
AudioConnection c02(audioIn, 0, row2, 0);
AudioConnection c03(audioIn, 0, row3, 0);
AudioConnection c04(audioIn, 0, row4, 0);
AudioConnection c05(audioIn, 0, column1, 0);
AudioConnection c06(audioIn, 0, column2, 0);
AudioConnection c07(audioIn, 0, column3, 0);
AudioConnection c10(sine1, 0, mixer, 0);
AudioConnection c11(sine2, 0, mixer, 1);
AudioConnection c12(mixer, 0, audioOut, 0);
AudioConnection c13(mixer, 0, audioOut, 1);
AudioConnection patchCord01(audioIn, 0, row1, 0);
AudioConnection patchCord02(audioIn, 0, row2, 0);
AudioConnection patchCord03(audioIn, 0, row3, 0);
AudioConnection patchCord04(audioIn, 0, row4, 0);
AudioConnection patchCord05(audioIn, 0, column1, 0);
AudioConnection patchCord06(audioIn, 0, column2, 0);
AudioConnection patchCord07(audioIn, 0, column3, 0);
AudioConnection patchCord10(sine1, 0, mixer, 0);
AudioConnection patchCord11(sine2, 0, mixer, 1);
AudioConnection patchCord12(mixer, 0, audioOut, 0);
AudioConnection patchCord13(mixer, 0, audioOut, 1);

// Create an object to control the audio shield.
//
@@ -45,7 +57,7 @@ void setup() {

// Enable the audio shield and set the output volume.
audioShield.enable();
audioShield.volume(0.75);
audioShield.volume(0.5);
while (!Serial) ;
delay(100);

+ 7
- 1
examples/HardwareTesting/PassThroughMono/PassThroughMono.ino Переглянути файл

@@ -1,8 +1,14 @@
/*
* A simple hardware test which receives audio on the A2 analog pin
* and sends it to the PWM (pin 3) output and DAC (A14 pin) output.
*
* This example code is in the public domain.
*/

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include "utility/pdb.h"

// GUItool: begin automatically generated code
AudioInputAnalog adc1; //xy=161,80

+ 22
- 24
examples/HardwareTesting/PassThroughStereo/PassThroughStereo.ino Переглянути файл

@@ -1,28 +1,26 @@
/*
* A simple hardware test which receives audio from the audio shield
* Line-In pins and send it to the Line-Out pins and headphone jack.
*
* This example code is in the public domain.
*/

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>

const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;

// Create the Audio components. These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
//AudioInputAnalog analogPinInput(16); // analog A2 (pin 16)
AudioInputI2S audioInput; // audio shield: mic or line-in
AudioOutputI2S audioOutput; // audio shield: headphones & line-out
AudioOutputPWM pwmOutput; // audio output with PWM on pins 3 & 4
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=200,69
AudioOutputI2S i2s2; //xy=365,94
AudioConnection patchCord1(i2s1, 0, i2s2, 0);
AudioConnection patchCord2(i2s1, 1, i2s2, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=302,184
// GUItool: end automatically generated code

// Create Audio connections between the components
//
AudioConnection c1(audioInput, 0, audioOutput, 0);
AudioConnection c2(audioInput, 1, audioOutput, 1);
AudioConnection c5(audioInput, 0, pwmOutput, 0);

// Create an object to control the audio shield.
//
AudioControlSGTL5000 audioShield;
const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;


void setup() {
@@ -30,10 +28,10 @@ void setup() {
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(12);

// Enable the audio shield and set the output volume.
audioShield.enable();
audioShield.inputSelect(myInput);
audioShield.volume(0.6);
// Enable the audio shield, select input, and enable output
sgtl5000_1.enable();
sgtl5000_1.inputSelect(myInput);
sgtl5000_1.volume(0.5);
}

elapsedMillis volmsec=0;
@@ -43,8 +41,8 @@ void loop() {
if (volmsec > 50) {
float vol = analogRead(15);
vol = vol / 1023.0;
audioShield.volume(vol);
volmsec = 0;
//audioShield.volume(vol); // <-- uncomment if you have the optional
volmsec = 0; // volume pot on your audio shield
}
}


Завантаження…
Відмінити
Зберегти