Bonjour à tous,
je travaille sur un projet consistant à utiliser le module infrarouge "IR receiver Module" combiné au buzzer passif. Alors l'objectif est qu'en utilisant une télécommande à infrarouge, le buzzer emet un son en fonction de la touche sur laquelle on appuie. Le code est le suivant:
#include "IRremote.h"
#include "pitches.h"
#define RED_LED_PIN 5
#define GREEN_LED_PIN 6
#define SOUND_DEC_PIN 2
int receiver = 11; // Signal Pin of IR receiver to Arduino Digital Pin 11
// notes in the melody:
int melody[] = {
NOTE_C5, NOTE_D5, NOTE_E5, NOTE_F5, NOTE_G5, NOTE_A5, NOTE_B5, NOTE_C6};
int duration = 500; // 500 miliseconds
/*-----( Declare objects )-----*/
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results; // create instance of 'decode_results'
/*-----( Function )-----*/
void interpreterSignal()
{
Serial.println(results.value, HEX);
switch(results.value)
{
case 0xFFA25D:
tone(8, melody[0], duration); //power
//digitalWrite(GREEN_LED_PIN,HIGH);
//digitalWrite(RED_LED_PIN,LOW);
break;
case 0xFFE21D:
//Serial.println("FUNC/STOP");
tone(8, melody[1], duration);
//digitalWrite(GREEN_LED_PIN,LOW);
//digitalWrite(RED_LED_PIN,HIGH);
break;
case 0xFF629D:
tone(8, melody[2], duration); //vol
//Serial.println("VOL+");
//digitalWrite(GREEN_LED_PIN,LOW);
//digitalWrite(RED_LED_PIN,HIGH);
break;
default:
tone(8, melody[5], duration);
//Serial.println(" other button ");
//digitalWrite(GREEN_LED_PIN,LOW);
//digitalWrite(RED_LED_PIN,HIGH);
}// End Case*/
void setup() /*----( SETUP: RUNS ONCE )----*/
{
Serial.begin(9600);
Serial.println("IR Receiver Button Decode");
irrecv.enableIRIn(); // Start the receiver
pinMode(RED_LED_PIN, OUTPUT); //L1 est une broche de sortie
pinMode(GREEN_LED_PIN, OUTPUT); //L1 est une broche de sortie
}/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
if (irrecv.decode(&results)) // have we received an IR signal?
{
interpreterSignal();
irrecv.resume(); // receive the next value
}
}/* --(end main loop )-- */
En compilant le code, j'obtiens l'erreur suivante:
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':* *(.text+0x0): multiple definition of
__vector_13'
libraries\IRremote\IRremote.cpp.o (symbol from plugin):(.text+0x0): first defined here
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
collect2.exe: error: ld returned 1 exit status
Comment resoudre le problème. Merci d'avance