SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By burned fingertips
hey all,

Newbie question. I've searched this forum for topics like "error" "verify" "mac" "github". but nothing really comes close to my problem. I've also searched the Github website with no luck.

I've done all the preloaded example sketches and gotten them to load to my Leonardo and Duemilnove boards without a problem. I signed up to Github to get sketches for IR remotes. When I try to upload sketches from there I get dozens of errors. They don't make sense to me. Is it because I'm using a mac? I've switched the board type to the appropriate board.

Importing libraries was complicated but I think I did it right. Thanks for any help.
By Valen
Guessing which errors you got is also complicated. And I am sure I will be doing it wrong. So spill those beans please. We are not psychic.
By burned fingertips
Thanks for the advice. I'm not looking for anyone "to do it for me" I have a lot ideas in my head but I seem to get stuck at step 1.

sketch_dec18a_RGB_LED:51: error: expected unqualified-id before numeric constant
sketch_dec18a_RGB_LED.ino: In function 'void setup()':
sketch_dec18a_RGB_LED:70: error: 'irrecv' was not declared in this scope
sketch_dec18a_RGB_LED.ino: In function 'void loop()':
sketch_dec18a_RGB_LED:84: error: 'irrecv' was not declared in this scope
sketch_dec18a_RGB_LED:84: error: 'results' was not declared in this scope
By burned fingertips
Here's the sketch from Git hub

#include <IRremote.h> // Include the IRremote library

/* Setup constants for SparkFun's IR Remote: */
#define NUM_BUTTONS 9 // The remote has 9 buttons
/* Define the IR remote button codes. We're only using the
least signinficant two bytes of these codes. Each one
should actually have 0x10EF in front of it. Find these codes
by running the IRrecvDump example sketch included with
the IRremote library.*/
const uint16_t BUTTON_POWER = 0xD827; // i.e. 0x10EFD827
const uint16_t BUTTON_A = 0xF807;
const uint16_t BUTTON_B = 0x7887;
const uint16_t BUTTON_C = 0x58A7;
const uint16_t BUTTON_UP = 0xA05F;
const uint16_t BUTTON_DOWN = 0x00FF;
const uint16_t BUTTON_LEFT = 0x10EF;
const uint16_t BUTTON_RIGHT = 0x807F;
const uint16_t BUTTON_CIRCLE = 0x20DF;

/* Connect the output of the IR receiver diode to pin 11. */
int RECV_PIN = 11;
/* Initialize the irrecv part of the IRremote library */
decode_results results; // This will store our IR received codes
uint16_t lastCode = 0; // This keeps track of the last code RX'd

/* Setup RGB LED pins: */
enum ledOrder // Make an enum to add some clarity in the code
RED, // 0
GREEN, // 1
BLUE // 2
const int rgbPins[3] = {5, 9, 6}; // Red, green, blue pins respectively
byte rgbValues[3] = {55, 23, 200}; // This keeps track of channel brightness
byte activeChannel = RED; // Start with RED as the active channel
boolean ledEnable = 1; // Start with the LED on.

void setup()
Serial.begin(9600); // Use serial to debug.
irrecv.enableIRIn(); // Start the receiver

/* Set up the RGB LED pins: */
for (int i=0; i<3; i++)
pinMode(rgbPins, OUTPUT);
analogWrite(rgbPins, rgbValues);

// loop() constantly checks for any received IR codes. At the
// end it updates the RGB LED.
void loop()
if (irrecv.decode(&results))
/* read the RX'd IR into a 16-bit variable: */
uint16_t resultCode = (results.value & 0xFFFF);

/* The remote will continue to spit out 0xFFFFFFFF if a
button is held down. If we get 0xFFFFFFF, let's just
assume the previously pressed button is being held down */
if (resultCode == 0xFFFF)
resultCode = lastCode;
lastCode = resultCode;

// This switch statement checks the received IR code against
// all of the known codes. Each button press produces a
// serial output, and has an effect on the LED output.
switch (resultCode)
if (ledEnable) ledEnable = 0;
else ledEnable = 1; // Flip ledEnable
case BUTTON_A:
activeChannel = RED;
case BUTTON_B:
activeChannel = GREEN;
case BUTTON_C:
activeChannel = BLUE;
rgbValues[activeChannel]++; // Increment brightness
rgbValues[activeChannel]--; // Decrement brightness
rgbValues[activeChannel] = 0; // Min brightness (off)
rgbValues[activeChannel] = 255; // Max brightness
rgbValues[activeChannel] = 127; // Medium brightness
Serial.print("Unrecognized code received: 0x");
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value

// Every time through the loop, update the RGB LEDs:
if (ledEnable)
for (int i=0; i<3; i++)
analogWrite(rgbPins, rgbValues);
for (int i=0; i<3; i++)
analogWrite(rgbPins, 0);
By motopic
Search your library folder for this function (use a text search) "irrecv"

sketch_dec18a_RGB_LED:84: error: 'irrecv' was not declared in this scope

Either IRremote.h (or c) is not there, or this function is not in the version you have.

The error is that the function irrecv cannot be found in the library search path, which for arduino usually means you do not have the .c file, or its not in the right folder. Or its the wrong version(which is why I believe all arduino libs should have a public version function). IF it appears right, check the line endings.

Finally, does IRremote have a demo or sample program? If yes, look at that.
By Valen
The line numbers in those errors do not seem to correspond with line-numbers of the related code statements from github. I mean, in line 70 or 84 I cannot find a reference to "irrecv". Those are on lines 42 and 56. (I copied that code from your post starting from the #-character, and pasted it unchanged into Notepad++ which shows linenumbers) So I find it a bit hard to correlate what it is complaining about. Did you leave out something from your own code perhaps, like comment info? It is important to post the code that generated these errors, including any changes you may have made. Though I do think motopic is right in the sense that you do not have the right libraries, or saved in the right place on your drive.
By burned fingertips
Thanks guys,
I'll have some time tonight to double check the code.I'm guessing I didn't save the libraries properly. I'll update when i figure it out.

I'm a firefighter and My ultimate goal is to control 12v LED emergency lights in the grill of my truck without making holes for switches and such. I don't mind drilling a small hole in the passenger foot well area for an IR receiver. I'll use the Sparkfun 9 button remote to turn all the lights on at once. I'll use another button for the electronic airhorn. It's kloogie but I think I'll use a relay shield to control the 12 volt lights.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]