Étape 7: SOURCE CODE
int piège ;
tom1 int ;
tom2 int ;
floortom int ;
cymbale int ;
int highhat ;
int stylecount = 0 ;
Sélectionnez 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) ; Sélectionnez puce
SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER) ;
Serial.println ("sd prêt ») ;
SdPlay.setFile("startup.raw") ; joue la tonalité de démarrage.
SdPlay.play() ;
}
void loop()
{
lire les broches analogiques
snarecount=analogRead(snarepin) ;
tom1choose=analogRead(tom1pin) ;
tom2=analogRead(tom2pin) ;
floortom=analogRead(floortompin) ;
cymbal=analogRead(cymbalpin) ;
Highhat=analogRead(highhatpin) ;
le tambour de sélection de style.
Si (snarecount > 100)
{
SdPlay.setFile("slctdrm.raw") ; Catherine dit « sélectionner l’orgelet tambourineurs! »
SdPlay.play() ;
stylecount = stylecount + 1 ;
}
Si (stylecount > 6)
{
stylecount = 1 ;
}
jouer le nom du style de tambour.
Si (stylecount == 1)
{
SdPlay.setFile("1_stdstl.raw") ; Catherine dit « standard drum set sélectionné! »
SdPlay.play() ;
}
Si (stylecount == 2)
{
SdPlay.setFile("2_afrcon.raw") ; Catherine dit « Afrique-congo style sélectionné! »
SdPlay.play() ;
}
Si (stylecount == 3)
{
SdPlay.setFile("3_hiho.raw") ; Catherine dit « style hip hop sélectionné »
SdPlay.play() ;
}
Si (stylecount == 4)
{
SdPlay.setFile("4_indian.raw") ; Catherine dit « style indien sélectionné »
SdPlay.play() ;
}
Si (stylecount == 5)
{
SdPlay.setFile("5_funny.raw") ; Catherine dit « sons drôles sélectionnées »
SdPlay.play() ;
}
Si (stylecount == 6)
{
SdPlay.setFile("6_demo.raw") ; joue la démo.
SdPlay.play() ;
}
___count pour sortir la batterie de sélectionner le mode de la broche.
Si (tom1choose > 50)
{
SdPlay.setFile("selected.raw") ;
SdPlay.play() ;
Sélectionnez = select + 1 ;
}
Serial.println("stylecount=") ;
Serial.println(stylecount) ;
Serial.println("Select=") ;
Serial.println(Select) ;
tandis que (sélectionnez == 1)
{
redefning les variables à tambour sonore déclencheurs.
Snare=analogRead(snarepin) ;
tom1=analogRead(tom1pin) ;
tom2=analogRead(tom2pin) ;
floortom=analogRead(floortompin) ;
cymbal=analogRead(cymbalpin) ;
Highhat=analogRead(highhatpin) ;
Si (snare > 50 & & stylecount == 1)
{
SdPlay.setFile("1_snare.raw") ;
SdPlay.play() ;
Serial.println("Snare") ;
}
Si (tom1 > 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 (cymbale > 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 ouvert") ;
}
//////////////////////////////////////////style 2
Si (snare > 50 & & stylecount == 2)
{
SdPlay.setFile("2_snare.raw") ;
SdPlay.play() ;
Serial.println("2snare") ;
}
Si (tom1 > 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 (cymbale > 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 ("2Ouvrez highhat") ;
}
//////////////////////////////////////////////style3
Si (snare > 50 & & stylecount == 3)
{
SdPlay.setFile("3_snare.raw") ;
SdPlay.play() ;
Serial.println("3snare") ;
}
Si (tom1 > 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 (cymbale > 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 ("3Ouvrir highhat") ;
}
style indien
Si (snare > 50 & & stylecount == 4)
{
SdPlay.setFile("4_snare.raw") ;
SdPlay.play() ;
Serial.println("4snare") ;
}
Si (tom1 > 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 (cymbale > 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 ("4Ouvrez highhat") ;
}
DRÔLE DE STYLE 5
Si (snare > 50 & & stylecount == 5)
{
SdPlay.setFile("5_snare.raw") ;
SdPlay.play() ;
Serial.println("5snare") ;
}
Si (tom1 > 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 (cymbale > 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 ("5Ouvrez highhat") ;
}
Si (stylecount == 6)
{
SdPlay.setFile("demo.raw") ;
SdPlay.play() ;
}
}
}