The library implements the NEC IR protocol, so set up the universal remote for any NEC device (TV, DVD, VCR, ...) and the 32-bit codes should be received.

The example sketch provided just prints out IR codes as they're received, so it's good to run that sketch to see what codes the remote is sending, so they can later be used to trigger specific actions:

The library is implemented to be similar to the Serial library functions 'begin,' 'available,' 'flush' and 'read.' Each IR code is 32-bits long (fits in an 'unsigned long' data type) and there's a buffer that can hold up to 8 codes before overflowing.

MikMo

ceady

Is there a particular version of the Arduino IDE that this library works with, because I can't run the library with 0010 or 0011 without getting an Error building library "NECIRrcv" then it gives me the following:

In file included from C:\Documents and Settings\User\My Documents\arduino-0011\hardware\cores\arduino/WProgram.h:6, from NECIRrcv.cpp:4:c:/documents and settings/user/my documents/arduino-0011/hardware/tools/avr/bin/../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr/interrupt.h>."NECIRrcv.cpp: In member function 'void NECIRrcv::begin()':NECIRrcv.cpp:15: error: 'TCCR2A' was not declared in this scopeNECIRrcv.cpp:20: error: 'TCCR2B' was not declared in this scopeNECIRrcv.cpp:25: error: 'TIMSK2' was not declared in this scope

trialex

Ignoring the warning you got (that always comes up when signal.h is used) the errors are saying that the various registers are not named correctly.

This means either

(a) the library was written for an arduino with an AtMega168 chip and you are using an arduino with an AtMega8 chipor(B) the library was written for an arduino with an AtMega8 chip and you are using an arduino with an AtMega168 chip

You can either go through the datasheets for the chips and correct the register names (not that hard, and you'll have a better understanding of what goes on in that black bit of plastic) or you can swap what chip you are using.

mikey

This library works great for me using the sample program to print out the remote codes.But, when I try to integrate it into my object-avoiding robot, things go bad. One of two motors stops completely, the other becomes intermittent. The stepper motor used for vision control "drifts" when not being driven, like it is being disconnected for short periods of time. I am using the servotimer1 library, but that just uses timer 1 and it looks like NECIRrcv is using timer 2.

Any idea what could be going wrong?Any idea how much RAM this library uses?

/* * Routine to figure out where to rotate to get the most unobstructed angle. */int bestDirection() { /* * Rotate the servo, building a map of the obstacles we see in front of us. * Record the position that is most unobstructed, scaled up to use as a delay factor when turning. */ refresh_view(0, NUM_SERVO_STEPS); int safest = furthestView(); return ((safest - STRAIGHT_AHEAD) * 50);}

Jacobson

hi, i am very new to arduino and programming. i have attempted to replicate the code above but for some unknown reason i get this really weird error message:"In file included from C:\Documents and Settings\Adam\Desktop\arduino-0012\hardware\cores\arduino/WProgram.h:4,

mikey

Maybe a syntax error of some kind? Did you cut and paste the code exactly as is, or type it in yourself? If the latter, post your code and maybe I can spot the problem. By the way, I got this working perfectly, basically by making sure the servo was stopped anytime I was reading the receiver. I think there was some interference going on.

Jacobson

hi, sorry i didnt mean to confuse but i copied and pasted the original code posted by jmknapp and for some reason recieved those errors. i copied and pasted exactly and cannot get it to work.any ideas?