Paso 7: Código de fuente
int caja;
CUSTOM1 int;
tom2 int;
int floortom;
platillo de int;
int highhat;
int stylecount = 0;
Seleccione int = 0;
int snarecount;
int tom1choose;
//////////////////////
const int snarepin = A0;
const int tom1pin = A1;
const int tom2pin = A2;
const int floortompin = A3;
const int cymbalpin = A4;
const int highhatpin = A5;
#include < SimpleSDAudio.h >
void setup()
{
Serial.Begin(9600);
SdPlay.setSDCSPin(10); seleccionar chip
SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER);
Serial.println ("sd listo");
SdPlay.setFile("startup.raw"); reproduce el sonido de arranque.
SdPlay.play();
}
void loop()
{
leyendo las clavijas analógicas
snarecount=analogRead(snarepin);
tom1choose=analogRead(tom1pin);
TOM2=analogRead(tom2pin);
Floortom=analogRead(floortompin);
Cymbal=analogRead(cymbalpin);
highhat=analogRead(highhatpin);
selección del estilo del tambor.
Si (snarecount > 100)
{
SdPlay.setFile("slctdrm.raw"); KIDU dice "Seleccione el orzuelo tambor!"
SdPlay.play();
stylecount = stylecount + 1;
}
Si (stylecount > 6)
{
stylecount = 1;
}
juega el nombre del estilo de tambor.
Si (stylecount == 1)
{
SdPlay.setFile("1_stdstl.raw"); KIDU dice "estándar drum set seleccionado!"
SdPlay.play();
}
Si (stylecount == 2)
{
SdPlay.setFile("2_afrcon.raw"); KIDU dice "congo africano estilo seleccionado!"
SdPlay.play();
}
Si (stylecount == 3)
{
SdPlay.setFile("3_hiho.raw"); KIDU dice "estilo hiphop seleccionados"
SdPlay.play();
}
Si (stylecount == 4)
{
SdPlay.setFile("4_indian.raw"); KIDU dice "estilo indio seleccionado"
SdPlay.play();
}
Si (stylecount == 5)
{
SdPlay.setFile("5_funny.raw"); KIDU dice "divertidos sonidos seleccionados"
SdPlay.play();
}
Si (stylecount == 6)
{
SdPlay.setFile("6_demo.raw"); juega el DEMO.
SdPlay.play();
}
___count para salir de los tambores de seleccionar modo de pin.
Si (tom1choose > 50)
{
SdPlay.setFile("selected.raw");
SdPlay.play();
seleccionar = select + 1;
}
Serial.println("stylecount=");
Serial.println(stylecount);
Serial.println("Select=");
Serial.println(Select);
mientras (seleccione == 1)
{
redefning las variables a ser tambor de sonido activa.
SNARE=analogRead(snarepin);
Tom1=analogRead(tom1pin);
TOM2=analogRead(tom2pin);
Floortom=analogRead(floortompin);
Cymbal=analogRead(cymbalpin);
highhat=analogRead(highhatpin);
Si (trampa > 50 & & stylecount == 1)
{
SdPlay.setFile("1_snare.raw");
SdPlay.play();
Serial.println("SNARE");
}
Si (CUSTOM1 > 50 & & stylecount == 1)
{
SdPlay.setFile("1_tom1.raw");
SdPlay.play();
Serial.println("Tom1");
}
Si (tom2 > 50 & & stylecount == 1)
{
SdPlay.setFile("1_tom2.raw");
SdPlay.play();
Serial.println("TOM2");
}
Si (floortom > 50 & & stylecount == 1)
{
SdPlay.setFile("1_ft.raw");
SdPlay.play();
Serial.println("Floortom");
}
Si (platillo > 50 & & stylecount == 1)
{
SdPlay.setFile("1_cy.raw");
SdPlay.play();
Serial.println("Cymbal");
}
Si (highhat > 50 & & stylecount == 1)
{
SdPlay.setFile("1_ohh.raw");
SdPlay.play();
Serial.println ("highhat abierto");
}
//////////////////////////////////////////style 2
Si (trampa > 50 & & stylecount == 2)
{
SdPlay.setFile("2_snare.raw");
SdPlay.play();
Serial.println("2snare");
}
Si (CUSTOM1 > 50 & & stylecount == 2)
{
SdPlay.setFile("2_tom1.raw");
SdPlay.play();
Serial.println("2tom1");
}
Si (tom2 > 50 & & stylecount == 2)
{
SdPlay.setFile("2_tom2.raw");
SdPlay.play();
Serial.println("2tom2");
}
Si (floortom > 50 & & stylecount == 2)
{
SdPlay.setFile("2_ft.raw");
SdPlay.play();
Serial.println("2floortom");
}
Si (platillo > 50 & & stylecount == 2)
{
SdPlay.setFile("2_cy.raw");
SdPlay.play();
Serial.println("2cymbal");
}
Si (highhat > 50 & & stylecount == 2)
{
SdPlay.setFile("2_ohh.raw");
SdPlay.play();
Serial.println ("2Abre highhat");
}
//////////////////////////////////////////////style3
Si (trampa > 50 & & stylecount == 3)
{
SdPlay.setFile("3_snare.raw");
SdPlay.play();
Serial.println("3snare");
}
Si (CUSTOM1 > 50 & & stylecount == 3)
{
SdPlay.setFile("3_tom1.raw");
SdPlay.play();
Serial.println("3tom1");
}
Si (tom2 > 50 & & stylecount == 3)
{
SdPlay.setFile("3_tom2.raw");
SdPlay.play();
Serial.println("3tom2");
}
Si (floortom > 50 & & stylecount == 3)
{
SdPlay.setFile("3_ft.raw");
SdPlay.play();
Serial.println("3floortom");
}
Si (platillo > 50 & & stylecount == 3)
{
SdPlay.setFile("3_cy.raw");
SdPlay.play();
Serial.println("3cymbal");
}
Si (highhat > 50 & & stylecount == 3)
{
SdPlay.setFile("3_ohh.raw");
SdPlay.play();
Serial.println ("highhat 3open");
}
estilo indio
Si (trampa > 50 & & stylecount == 4)
{
SdPlay.setFile("4_snare.raw");
SdPlay.play();
Serial.println("4snare");
}
Si (CUSTOM1 > 50 & & stylecount == 4)
{
SdPlay.setFile("4_tom1.raw");
SdPlay.play();
Serial.println("4tom1");
}
Si (tom2 > 50 & & stylecount == 4)
{
SdPlay.setFile("4_tom2.raw");
SdPlay.play();
Serial.println("4tom2");
}
Si (floortom > 50 & & stylecount == 4)
{
SdPlay.setFile("4_ft.raw");
SdPlay.play();
Serial.println("4floortom");
}
Si (platillo > 50 & & stylecount == 4)
{
SdPlay.setFile("4_cy.raw");
SdPlay.play();
Serial.println("4cymbal");
}
Si (highhat > 50 & & stylecount == 4)
{
SdPlay.setFile("4_ohh.raw");
SdPlay.play();
Serial.println ("highhat 4open");
}
ESTILO 5 FUNNY
Si (trampa > 50 & & stylecount == 5)
{
SdPlay.setFile("5_snare.raw");
SdPlay.play();
Serial.println("5snare");
}
Si (CUSTOM1 > 50 & & stylecount == 5)
{
SdPlay.setFile("5_tom1.raw");
SdPlay.play();
Serial.println("5tom1");
}
Si (tom2 > 50 & & stylecount == 5)
{
SdPlay.setFile("5_tom2.raw");
SdPlay.play();
Serial.println("5tom2");
}
Si (floortom > 50 & & stylecount == 5)
{
SdPlay.setFile("5_ft.raw");
SdPlay.play();
Serial.println("5floortom");
}
Si (platillo > 50 & & stylecount == 5)
{
SdPlay.setFile("5_cy.raw");
SdPlay.play();
Serial.println("5cymbal");
}
Si (highhat > 50 & & stylecount == 5)
{
SdPlay.setFile("5_ohh.raw");
SdPlay.play();
Serial.println ("highhat 5open");
}
Si (stylecount == 6)
{
SdPlay.setFile("demo.raw");
SdPlay.play();
}
}
}