The cod from Github that Becky said in the video to download gives me a "cannot compile" error message.
How can i fix it?
Code doesnt work
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23940
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Code doesnt work
Which code?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 video?
How are you using it?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Code doesnt work
Please let us know what kind of arduino you are using and what code you are trying to download from GitHub.
-
- Posts: 52
- Joined: Sun Sep 04, 2011 7:37 am
Re: Code doesnt work
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.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Code doesnt work
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.
-
- Posts: 52
- Joined: Sun Sep 04, 2011 7:37 am
Re: Code doesnt work
which code should i download? the .cpp or the .h?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Code doesnt work
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.
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.
-
- Posts: 52
- Joined: Sun Sep 04, 2011 7:37 am
Re: Code doesnt work
now it says 'AdafruitNFCShield_I2C' does not name a type
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Code doesnt work
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.
If you don't see that, either the folder is mis-named or you might have one extra 'nesting' of folders or something.
-
- Posts: 52
- Joined: Sun Sep 04, 2011 7:37 am
Re: Code doesnt work
I forgot the capital a in adafruit so i fixed it but the same error message appears when i try to compile the code
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Code doesnt work
You need all the capitalization and underscores to be exactly correct.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
-
- Posts: 52
- Joined: Sun Sep 04, 2011 7:37 am
Re: Code doesnt work
Now its all correctly typed
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Code doesnt work
And does it work?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Code doesnt work
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. 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. 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.
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. 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. 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.
Please be positive and constructive with your questions and comments.