Go Down

Topic: Error compiling again! (Read 6962 times) previous topic - next topic

arduinohabib

I asked this question before, and I am ashamed to ask this question again, but I have encountered the"Error Compiling" message when I try to compile my program. When I asked this question last time, I was asked to add
Quote
// WCharacter.h prototypes
inline boolean isAlphaNumeric(int c) __attribute__((always_inline));
to the program, or to put an other deceleration in the front. But this time these two methods don't work. Can anyone help me? A million thanks.
P.S. This is the code I am trying to compile:
Quote

#include "pitches.h"
#include <IRremote.h>
int RECV_PIN = 8;
int ledPin =  7;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(ledPin, OUTPUT);
}
 
void loop() {
 
  if (irrecv.decode(&results)) {
    Serial.println(results.value, DEC);
  }
    if(results.value == 150996993){
      tone(6, NOTE_C4, 4);
  }
    if(results.value == 151029889){
      tone(6, NOTE_D4, 4);
    }
    if(results.value == 151013441){
      tone(6, NOTE_E4, 4);
    }
    irrecv.resume(); // Receive the next value
  }

What is man's best friend? The breadboard!

WizenedEE

Please post the exact error message here.

Also, do you have pitches.h in another tab?

arduinohabib

The error message is "error compiling", and I do have "pitches.h" on in the other tab.
What is man's best friend? The breadboard!

WizenedEE

No, an error looks like this (copied arbitrarily from another thread):
Code: [Select]

C:\Documents and Settings\Albert\Desktop\arduino-1.0.1\libraries\PS2Keyboard/PS2Keyboard.h:168: error: expected ',' or ';' before 'typedef'
C:\Documents and Settings\Albert\Desktop\arduino-1.0.1\libraries\PS2Keyboard/PS2Keyboard.h:173: error: expected constructor, destructor, or type conversion before ';' token
C:\Documents and Settings\Albert\Desktop\arduino-1.0.1\libraries\PS2Keyboard/PS2Keyboard.h:176: error: 'PS2Keymap_t' does not name a type
C:\Documents and Settings\Albert\Desktop\arduino-1.0.1\libraries\PS2Keyboard/PS2Keyboard.h:177: error: 'PS2Keymap_t' does not name a type
C:\Documents and Settings\Albert\Desktop\arduino-1.0.1\libraries\PS2Keyboard/PS2Keyboard.h:197: error: expected ',' or '...' before '&' token
C:\Documents and Settings\Albert\Desktop\arduino-1.0.1\libraries\PS2Keyboard/PS2Keyboard.h:197: error: ISO C++ forbids declaration of 'PS2Keymap_t' with no type
Lcd_screen___keyboard.cpp: In function 'void setup()':
Lcd_screen___keyboard:172: error: no matching function for call to 'PS2Keyboard::begin(const int&, const int&)'
C:\Documents and Settings\Albert\Desktop\arduino-1.0.1\libraries\PS2Keyboard/PS2Keyboard.h:197: note: candidates are: static void PS2Keyboard::begin(uint8_t, uint8_t, int)
Lcd_screen___keyboard.cpp: In function 'void loop()':
Lcd_screen___keyboard:186: error: 'LcdStringln' was not declared in this scope
Lcd_screen___keyboard:208: error: invalid conversion from 'char' to 'char*'
Lcd_screen___keyboard:208: error: initializing argument 1 of 'void LcdString(char*)'

arduinohabib

Oh ok this is what it is:
Quote
core.a(Tone.cpp.o): In function `__vector_13':
C:\Users\Habib\Downloads\arduino-1.0.1-windows (2)\arduino-1.0.1\hardware\arduino\cores\arduino/Tone.cpp:523: multiple definition of `__vector_13'
arduinoirremote\IRremote.cpp.o:D:\Tech\Arduino\libraries\arduinoirremote/IRremote.cpp:311: first defined here
c:/users/habib/downloads/arduino-1.0.1-windows (2)/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
What is man's best friend? The breadboard!

pYro_65

It appears the tone library and IRremote library both user timer 2 interrupts to do their work.

arduinohabib

So what can I do about it?
What is man's best friend? The breadboard!

Tom Carpenter

(a) don't use tone (not ideal)
(b) modify the IR library to use a different timer (not *too* difficult)

Which arduino do you have? (Mega, Uno, Leonardo etc.)
~Tom~

arduinohabib

#8
Oct 06, 2012, 05:15 am Last Edit: Oct 06, 2012, 06:27 am by arduinohabib Reason: 1
I have a Mega 2560. How do I modify the timer?
P.S. I modified the code so it doesn't use "pitches.h".
Quote
Quote

#include <IRremote.h>
int RECV_PIN = 8;
int ledPin =  7;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(ledPin, OUTPUT);
}
 
void loop() {
 
  if (irrecv.decode(&results)) {
    Serial.println(results.value, DEC);
  }
    if(results.value == 150996993){
      tone(6, 262, 4);
  }
    if(results.value == 151029889){
      tone(6, 294, 4);
    }
    if(results.value == 151013441){
      tone(6, 330, 4);
    }
    irrecv.resume(); // Receive the next value
  }

What is man's best friend? The breadboard!

Nick Gammon

For future reference please use code tags for code, not quotes.

Read this before posting a programming question

I know there is a "Copy for forum" in the Arduino IDE. Please don't use it. <sigh>
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up