# new to Ardunio but trying to compile

#### MrDEB

##### 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??
Code:
#include <IRremote.h>

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

void setup()
{
Serial.begin(9600);
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value); // Print the Serial 'results.value'
delay(10);

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

#### Visitor

##### Well-Known Member
It would be helpful to know what the exact error message is, but Google is your friend.

#### Musicmanager

##### 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 ?

MM

#### MrDEB

##### Well-Known Member
yes that's ALL the code.
will try with an empty line after

#### MrDEB

##### Well-Known Member
error says stray "/302"

#### MrDEB

##### Well-Known Member
still won't must be missing something??

#### Attachments

• 110.2 KB Views: 20

#### Visitor

##### 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.

#### MrDEB

##### Well-Known Member
I typed in all the code but will go and check again

#### Visitor

##### 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.

#### rjenkinsgb

##### Well-Known 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.

#### Musicmanager

##### Active Member

It'll show you an eroneous character .. .. .

MM

#### rjenkinsgb

##### Well-Known Member
Yes, true, but that means more complexity and could cause more, well, "cascade failures", to keep it polite.

#### Visitor

##### 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?

Works for me !

#### Ian Rogers

##### User Extraordinaire
Forum Supporter
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.

#### MrDEB

##### 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?