Code doesnt work

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 7:37 am

Code doesnt work

Post by baileygrib »

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

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Code doesnt work

Post by Franklin97355 »

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
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Code doesnt work

Post by adafruit_support_rick »

Please let us know what kind of arduino you are using and what code you are trying to download from GitHub.

baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 7:37 am

Re: Code doesnt work

Post by baileygrib »

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.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Code doesnt work

Post by adafruit_support_rick »

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.

baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 7:37 am

Re: Code doesnt work

Post by baileygrib »

which code should i download? the .cpp or the .h?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Code doesnt work

Post by adafruit_support_rick »

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.

baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 7:37 am

Re: Code doesnt work

Post by baileygrib »

now it says 'AdafruitNFCShield_I2C' does not name a type

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Code doesnt work

Post by pburgess »

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.

baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 7:37 am

Re: Code doesnt work

Post by baileygrib »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Code doesnt work

Post by adafruit_support_rick »

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.

baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 7:37 am

Re: Code doesnt work

Post by baileygrib »

Now its all correctly typed

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Code doesnt work

Post by adafruit_support_rick »

And does it work?

baileygrib
 
Posts: 52
Joined: Sun Sep 04, 2011 7:37 am

Re: Code doesnt work

Post by baileygrib »

No same error

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Code doesnt work

Post by adafruit_support_rick »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”