Bonjour,
Je souhaite communiquer (question/Réponse) avec un robot de ma fabrication et utiliser un module TMRpcm connecté sur une MEGA 2560 R3
J'ai utilisé Audacity pour créer mes WAV avec les normes en vigueur pour utiliser sur le module TMRpcm
Pour essai j'utilise un code BASIC Arduino qui a l'air de fonctionner sauf que le HP, branché sur la MEGA, ne fait que grésiller. Le grésillement correspond bien au nombre de mots que je devrais entendre.
Ci dessous le code utilisé
Quelqu'un aurait une idée ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 #include <SD.h> // need to include the SD library //#define SD_ChipSelectPin 53 //example uses hardware SS pin 53 on Mega2560 #define SD_ChipSelectPin 53 //using digital pin 4 on arduino nano 328, can use other pins #include <TMRpcm.h> // also need to include this library... #include <SPI.h> TMRpcm tmrpcm; // create an object for use in this sketch void setup() { tmrpcm.speakerPin = 46; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc tmrpcm.setVolume(3); Serial.begin(9600); if (!SD.begin(SD_ChipSelectPin)) { // see if the card is present and can be initialized: Serial.println("SD fail"); return; // don't do anything more if not } tmrpcm.play("NameBOB.wav"); //the sound file "music" will play each time the arduino powers up, or is reset } void loop() { if (Serial.available()) { if (Serial.read() == 'p') { //send the letter p over the serial monitor to start playback tmrpcm.play("NameBOB.wav"); } } }
Merci
Partager