• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

new to Ardunio but trying to compile


Well-Known Member
here is my short code that shows an error in line 23 (something about error 302?)
have two books Ardunio programming in 24 hours and Ardunio cook book but no solution? Tried typing code but this 302??
#include <IRremote.h>

int IRpin = 8;
IRrecv irrecv(IRpin);
decode_results results;

void setup()
    irrecv.enableIRIn(); // Start the receiver
void loop() 
    if (irrecv.decode(&results)) 
         Serial.println(results.value); // Print the Serial 'results.value'

         irrecv.resume();   // Receive the next value


Active Member
Is that ALL your code ? There's only 22 lines of code shown ?

Loaded it into Arduino IDE and it compiled without issue ?



Well-Known Member
Did you actually read any of those search results?

You have a stray non-prinitable character in your code. Most likely at the start or end, from copy/pasting.


Well-Known Member
Did you copy&paste this code from someplace, or did you install the IRremote library and find this code in the Arduino Examples directory? I suspect it was copy&paste because this error wouldn't have come from a sketch in the example folder.

So, if you copy&paste the code from somewhere, you actually grabbed too much. You got some extra characters either at the beginning of the code or most likely at the end. HTML uses invisible characters to control formatting.

The code you've posted here reportedly works without problem, but you copy&pasted the code to post it here, so you may not have happened to include this invisible character, so testing the code you posted doesn't prove anything.

So, the options are:

o Install the IRremote library, and use examples out of the Arduino example folder.

o Start absolutely fresh with a new blank sketch and copy the file again, being certain to only copy from the first letter to the last without any extra blank space or any other characters.

I have used Arduino enough to know it's a major pain in the butt compared to Swordfish. There are many levels of complexity, starting with the need to install libraries. Proper formatting of the code has been really confusing to me.


Well-Known Member
Most Helpful Member
Copy the whole program to Notepad.

Delete the original.
Copy and paste it back from notepad to the editor.

That should remove any invisible non-ASCII characters.

(Note, Notepad, NOT "wordpad" or any other editor!)


Well-Known Member
Dies Note Pad still do this? I used to do this all the time to remove formatting but I thought recent versions were not such good "cleansers", perhaps when it included unicode support?

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
I agree with WP100.. There will be no library available for the code....

NOW!!! We all need to take a deep breath... MrDeb is now doing what we all asked him to do.. Hold off with the negativeness..

MrDEB.. In the menu look for "Include Library " then select manager and type "IRremote" and click install.


Well-Known Member
My plan is to re type entire code but this notepad++.
need to look at that.
As for library, I have the correct library and recent IDE. I think its 1.8?

Latest threads

EE World Online Articles