grabar microfono en tarjeta arduino sd code example
Example: grabar microfono en tarjeta arduino sd
#include <SimpleSDAudio.h>
const int boton1 = 1;
int buttonState1 = 0;
const int boton2 = 2;
int buttonState2 = 0;
const int boton3 = 3;
int buttonState3 = 0;
const int boton5 = 5;
int buttonState5 = 0;
const int boton6 = 6;
int buttonState6 = 0;
const int boton7 = 7;
int buttonState7 = 0;
const int boton8 = 8;
int buttonState8 = 0;
void setup()
{
SdPlay.init(SSDA_MODE_HALFRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER);
pinMode(boton1, INPUT);
pinMode(boton2, INPUT);
pinMode(boton3, INPUT);
pinMode(boton5, INPUT);
pinMode(boton6, INPUT);
pinMode(boton7, INPUT);
pinMode(boton8, INPUT);
}
void loop(void) {
buttonState1 = digitalRead(boton1);
buttonState2 = digitalRead(boton2);
buttonState3 = digitalRead(boton3);
buttonState5 = digitalRead(boton5);
buttonState6 = digitalRead(boton6);
buttonState7 = digitalRead(boton7);
buttonState8 = digitalRead(boton8);
if (buttonState1 == HIGH) {
SdPlay.setFile("aa.wav");
SdPlay.play();
}
if (buttonState2 == HIGH) {
SdPlay.stop();
SdPlay.setFile("pre1.wav");
SdPlay.play();
}
if (buttonState3 == HIGH) {
SdPlay.setFile("musica.wav");
SdPlay.play();
}
if (buttonState5 == HIGH) {
SdPlay.setFile("ad.wav");
SdPlay.play();
}
if (buttonState6 == HIGH) {
SdPlay.setFile("as.wav");
SdPlay.play();
}
if (buttonState7 == HIGH) {
SdPlay.setFile("ag.wav");
SdPlay.play();
}
if (buttonState8 == HIGH) {
SdPlay.setFile("desp3.wav");
SdPlay.play();
}
}