Can anyone help me out (iR related)

I have this problem with my arduino. I want to use the NECIRrcv library, but in every scenario it gives me different errors. The problem is that when I try to upload the sketch, it gives loads of problems witch I will put here.

The only Thing that is the same every time is the following sketch and the board: The Arduino Duemilanove.

// look for IR codes and print them as they are received

#include <NECIRrcv.h>
#define IRPIN 4    // pin that IR detector is connected to

NECIRrcv ir(IRPIN) ;

void setup()
{
  Serial.begin(9600) ;
  Serial.println("NEC IR code reception") ;
  ir.begin() ;
}

void loop()
{
  unsigned long ircode ;
  
  while (ir.available()) {
    ircode = ir.read() ;
    Serial.print("got code: 0x") ;
    Serial.println(ircode,HEX) ;
  }
}

Scenario 1.
Platform: Vista x64
IDE:0016
Error: something like this!(brother is playing Fallout 3 now so i cant go on that pc now!

In file included from /home/wouter/arduino-0011/hardware/cores/arduino/WProgram.h:6,
                 from NECIRrcv.cpp:4:
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete.  Use <avr/interrupt.h>."
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:80: error: expected unqualified-id before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:80: error: expected `)' before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:80: error: expected `)' before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:111: error: expected unqualified-id before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:111: error: expected `)' before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:111: error: expected `)' before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:144: error: expected identifier before '(' token
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:144: error: expected `)' before '(' token
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:144: error: expected ',' or '...' before '(' token
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:144: error: expected initializer before ')' token
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:176: error: '__compar_fn_t' has not been declared
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/math.h:439: error: expected unqualified-id before 'double'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/math.h:439: error: expected `)' before 'double'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/math.h:439: error: expected `)' before 'double'
o: In function `__static_initialization_and_destruction_0(int, int)':
undefined reference to `NECIRrcv::NECIRrcv(int)'o: In function `loop':
o: In function `setup':

Scenario 2.
Platform: Vista x64
IDE:0011 (i read somewhere that it only works with 0011)
Error: The well-known “Can’t find Com1” Error. And Tools->Serial Port is all greyed out. :-/

Scenario 3.
Platform: x86 Opensuse
IDE: 0011
Error:

In file included from /home/wouter/arduino-0011/hardware/cores/arduino/WProgram.h:6,
                 from NECIRrcv.cpp:4:
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete.  Use <avr/interrupt.h>."
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:80: error: expected unqualified-id before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:80: error: expected `)' before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:80: error: expected `)' before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:111: error: expected unqualified-id before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:111: error: expected `)' before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:111: error: expected `)' before 'int'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:144: error: expected identifier before '(' token
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:144: error: expected `)' before '(' token
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:144: error: expected ',' or '...' before '(' token
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:144: error: expected initializer before ')' token
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/stdlib.h:176: error: '__compar_fn_t' has not been declared
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/math.h:439: error: expected unqualified-id before 'double'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/math.h:439: error: expected `)' before 'double'
/opt/cross/lib/gcc/avr/4.1.3/../../../../avr/include/math.h:439: error: expected `)' before 'double'
o: In function `__static_initialization_and_destruction_0(int, int)':
undefined reference to `NECIRrcv::NECIRrcv(int)'o: In function `loop':
o: In function `setup':

If the .h file it has a line like
#include <wiring.h>
Remove it and add it to the cpp file if its not already there.

If you still get error messages then you may need to add some other include files, such as :
#include <inttypes.h>

But its hard to know without seeing the messages.

it still doesn't work. i think that if i could fix the 'greyed out' Tools->serial port, it works.

I finally got it uploaded on the vista x64 PC. it seems that i forgot to install the x64 driver for IDE0011. (n00b fail, though) but the next problem is that it wont receive any ir codes. i think there is a problem in the wiring on the breadboard. i use the Vishay TSOP1738 (38KHz) Datasheet with wiring diagram : http://www.datasheetcatalog.org/datasheets/208/301092_DS.pdf

here is the current wiring on the breadboard. i used brand new part from the local radioshack. http://img268.imageshack.us/img268/6484/arduinoir.jpg

oh and i put the IR pin on 2, it was a lot easier in a early stage

thanks for the help

I have not used that sensor but I think you want to swap the red and green wires, green (Gnd) should go to the center pin of the ir sensor, red to the output pin. If that is a jumper connect the ir output to ground, it should be removed.

HMmmm… it is uploaded now but even without the cap and resistorin the curcuit, and still it doesnt give any signal. Does anyone have an idea? just to be sure: is it digital or analog? it isn’t used anywherein the code, so it must be in the lib.

Thanks, wouternet

You don't say if you have fixed the things mentioned in my previous post. Perhaps post another picture showing how it is now wired.

I would think the input is digital, do you have a link to the place you downloaded that library ?

Here is the filehttp://www.megaupload.com/?d=OS88QW58
and here is a photo, as asked.
http://h.imagehost.org/view/0590/DSCF8703

and yes i tried the previous post from Mem, but it didn’t work. it could be that the sensor is burned out due to a short circuit when i was modding the wiring…

It does look like it is now wired correctly. The library is reading the pin as a digital signal. One test you could try is to write a simple sketch (without the library) the sets pin 2 as an input and in loop do a digitalRead of pin 2. set the LED on pin 13 high if pin 2 is high, low of pin 2 is low. You should see the LED light when you point a remote with the correct protocal at your sensor. If that doesn't work, try connecting a 10k resistor from pin 2 to +5 volts (or you can enable the internal pulls-up resistor). If you still get no response from the remote then perhaps your sensor is faulty.

It works now with the simple sketch with now library, so it isn't a faulty sensor. i'll try to find another sketch to serial those bits out. does somebody here knows a decent ir sketch, just to to be sure.

thanks in advance

!!

I just have to say, that NECIRRcv library is AMAZING. I’ve tried almost every IR sketch that I found, mostly outputting timers of highs and lows.
With the sketch included, it outputs in I believe is HEX, and they’re always the same.

Previous sketches I’ve had will repeat random numbers each time I input a key, but this ones awesome! I haven’t tried to use that to send commands out yet, just using it for remote controlled lights! (woot!)

Do keep in mind, the Example included with the library will NOT work unless you use #include <WProgram.h> at the top of the sketch.

But great great GREAT library, hopefully we can get it uploaded to the Arduino playground so we don’t have to search for this post everytime somebody needs the library.

Another thing to keep in mind, this only works with certain remotes. Works great with my TV remote and dvd remote, but my Dish Network remote, even when it’s on tv, I get nothing. So try another remote if you don’t have any luck!

Hey I want to Thank you so much, it works now!!! it even works now with the new 0017 IDE!! Awsome!

Thanks everybody!