Pages: [1]   Go Down
Author Topic: Error compiling again!  (Read 1689 times)
0 Members and 1 Guest are viewing this topic.
Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
  }

Logged

What is man's best friend? The breadboard!

Offline Offline
Edison Member
*
Karma: 17
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please post the exact error message here.

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

Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The error message is "error compiling", and I do have "pitches.h" on in the other tab.
Logged

What is man's best friend? The breadboard!

Offline Offline
Edison Member
*
Karma: 17
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, an error looks like this (copied arbitrarily from another thread):
Code:
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*)'
Logged

Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

What is man's best friend? The breadboard!

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 52
Posts: 1778
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So what can I do about it?
Logged

What is man's best friend? The breadboard!

Leeds, UK
Offline Offline
Edison Member
*
Karma: 71
Posts: 1641
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

(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.)
Logged

~Tom~

Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
  }

« Last Edit: October 05, 2012, 11:27:35 pm by arduinohabib » Logged

What is man's best friend? The breadboard!

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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>
Logged

Pages: [1]   Go Up
Jump to: