Code doesnt work

by baileygrib on Wed Dec 26, 2012 3:27 pm

The cod from Github that Becky said in the video to download gives me a "cannot compile" error message.
How can i fix it?
baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 6:37 am

Re: Code doesnt work

by franklin97355 on Wed Dec 26, 2012 9:15 pm

The cod from Github that Becky said in the video to download gives me a "cannot compile" error message.
How can i fix it?

Which code?
Which video?
How are you using it?
User avatar
franklin97355
 
Posts: 2662
Joined: Mon Apr 21, 2008 1:33 pm

Re: Code doesnt work

by adafruit_support_rick on Wed Dec 26, 2012 9:28 pm

Please let us know what kind of arduino you are using and what code you are trying to download from GitHub.
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Code doesnt work

by baileygrib on Thu Dec 27, 2012 1:48 pm

lol sorry i was typing this really fast. I was talking about the RFID shield code that was in the video on how to make the shield. I am using a leonardo.
baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 6:37 am

Re: Code doesnt work

by adafruit_support_rick on Thu Dec 27, 2012 2:25 pm

Have you downloaded and installed the Adafruit_NFCShield_I2C library? What sketch are you trying to compile? Please post the exact error messages you are seeing (copy and paste from the Arduino window). The first few errors are the most important ones.
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Code doesnt work

by baileygrib on Thu Dec 27, 2012 2:40 pm

which code should i download? the .cpp or the .h?
baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 6:37 am

Re: Code doesnt work

by adafruit_support_rick on Thu Dec 27, 2012 3:35 pm

You probably ought to take a look at the tutorial, here.

You want to download the entire Adafruit_NFCShield_I2C library from github. You'll see a 'ZIP' button near the top of the page. Click that, uncompress the folder and rename the folder Adafruit_NFCShield_I2C (inside the folder you should see the Adafruit_NFCShield_I2C.cpp and Adafruit_NFCShield_I2C.h files). Install the library by placing the Adafruit_NFCShield_I2C folder in your arduinosketchfolder/libraries folder. You may have to create the libraries subfolder if this is your first library. You can read more about installing libraries in our tutorial

Restart the Arduino IDE. You should now be able to select File > Examples > Adafruit_NFCShield_I2C > readMifare sketch. Upload the sketch to your Arduino with the shield plugged in.
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Code doesnt work

by baileygrib on Thu Dec 27, 2012 5:56 pm

now it says 'AdafruitNFCShield_I2C' does not name a type
baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 6:37 am

Re: Code doesnt work

by pburgess on Thu Dec 27, 2012 6:54 pm

Make sure the folder is named 'Adafruit_NFCShield_I2C' exactly, with the underscores and same upper & lower case, then quit & restart the Arduino IDE. If the library is properly installed, you should be able to navigate through the menus File->Sketchbook->Libraries->Adafruit_NFCShield_I2C->(names of four example sketches)

If you don't see that, either the folder is mis-named or you might have one extra 'nesting' of folders or something.
User avatar
pburgess
 
Posts: 2180
Joined: Sun Oct 26, 2008 1:29 am

Re: Code doesnt work

by baileygrib on Fri Dec 28, 2012 9:53 pm

I forgot the capital a in adafruit so i fixed it but the same error message appears when i try to compile the code
baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 6:37 am

Re: Code doesnt work

by adafruit_support_rick on Sat Dec 29, 2012 1:23 am

baileygrib wrote:I forgot the capital a in adafruit so i fixed it but the same error message appears when i try to compile the code

You need all the capitalization and underscores to be exactly correct.
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Code doesnt work

by baileygrib on Sat Dec 29, 2012 8:58 am

Now its all correctly typed
baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 6:37 am

Re: Code doesnt work

by adafruit_support_rick on Sat Dec 29, 2012 11:09 am

And does it work?
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Code doesnt work

by baileygrib on Sat Dec 29, 2012 4:45 pm

No same error
baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 6:37 am

Re: Code doesnt work

by adafruit_support_rick on Sat Dec 29, 2012 7:59 pm

Alright, I want you to do two things for me. First, look at the the screenshots I've just posted here. I'm running a Mac, but don't worry if you're on Windows - the details will be the same.

First, make sure that your folder structure look just like mine does. In my Arduino folder, with all my sketches, I have the 'libraries' folder. In side of that, I have the 'Adafruit_NFCShield_I2C' folder, and that folder contains both the Adafruit_NFCShield_I2C.cpp and Adafruit_NFCShield_I2C.h files.
libraries_directory.png
libraries_directory.png (150.39 KiB) Viewed 1063 times

Notice how the name of the folder, the name of the files, and the name of the thing that's giving you the error are all spelled exactly the same? They are all spelled 'Adafruit_NFCShield_I2C'.

Make sure you've got the same folder structure.

Second, I want you to run your Arduino application, and open the 'Preferences' window. Again, I've got a Mac, but the Preferences will look pretty much the same in Windows.
arduino_prefs.png
arduino_prefs.png (67.8 KiB) Viewed 1063 times

At the top of the window, you'll see a box labelled "Sketchbook Location". That box must have a path to the same Arduino folder which contains your libraries folder with the NFC library, just like it does in my picture.

So, go through and make sure your Adafruit_NFCShield_I2C folder is in the right place, has the right name, and contains the right files.
Close down your Arduino application, and then restart it.
Try your NFC sketch.

If it still doesn't work, then I want you to make a screenshot of your directories, and a screenshot of your Preferences window, just like mine, and post them here.

I also want you to copy and paste any error messages you get.

It really is not enough for you to just tell us that you "got an error". We need to see the exact text of the errors, even if they just look like gibberish.
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY