pn532搭配arduino使用例子在板中_第1頁
pn532搭配arduino使用例子在板中_第2頁
pn532搭配arduino使用例子在板中_第3頁
已閱讀5頁,還剩3頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、Using with the Arduino Leonardo注: Arduino Leonardo 是一塊開發(fā)板The IRQ pin is tied to Digital pin #2 by default. However, on the Arduino Leonardo, digital #2 is used for I2C which will not work. If using wiLeonardo, cut the traceben the IRQ pin and Digital #2 and solder a wire from IRQ po Digital #4 or hi

2、gher. Then change the exle code so the the IRQ pin is declared as the new pin (say #6) not#2Here are some photos of setting the IRQ po digital 6., use a sharp hobby knife to cut the trace from IRQ to 2Solder a wire from IRQ to #6Which Library?Arduino Leonardo 開發(fā)板有兩個庫(希望能在合并為 1 個)是為了 PN532 的NFC 板。 一個

3、是 SPI 接口庫另一個庫 I2C 接口的庫。兩者都具有相同的功能和性能,不同的只是他們與 PN532SPI 庫。為了方便兼容的接口是 I2C 或 SPI 而已。本 PN532 開發(fā)板假定您將使用 I2C 庫。(下面就不逐個翻譯了)假定您將使用Both libraries have the ability to read MiFare cards, including the hard-coded IDnumbers, as well as authenticate and read/write EEPROM cI2C Library FOR USE WITH THE SHIELD ONLYk

4、sDownload the PN532 I2C library from.press the folder and rename thefolderAdafruit_NFCShield_I2C. Inside the folder you should seetheAdafruit_NFCShield_I2p anfruit_NFCShield_I2C.h files. InstalltheAdafruit_NFCShield_I2C library foler by placing it inyour arduinosketchfolder/librariesfolder. You may

5、have to createthe librariebfolder if this is yourlibrary. You can read more about installinglibraries in our tutorial.Restart the Arduino IDE. You should now be able to select File Exles Adafruit_NFCShield_I2C readMifare sketch. Upload the sketch to your Arduino with the shield plugged in.SPI Librar

6、y FOR USE WITH THE BREAKOUT BOARD ONLYDownload the PN532 SPI library from.(已好在開發(fā)板資料里)press the folder and rename the folderAdafruit_PN532. Inside the folder youshould see the Adafruit_PN532.cpp anfruit_PN532.h files. InstallCheck out our super-detailed tutorial for all operating systems here: HYPERL

7、INK http:/l/ http:/l/adafruit-all-about-arduino-libraries-install-useWhat is a library?Libraries are great pla, and not yet illegalhe United Ses! If you ever need to learnhow to do something, like say fix a motorcycle, you can go to your local library and take out abook. Sure you could buy the book

8、but the library is nice because as a resource you can get the book whenever you need it, keng your house uncluttered.Software Libraries are very similar. We already studied what a procedure is, in lesson 3: aprocedure is a list of things to do. A library is a big collection of procedures, where all

9、the procedures are related! If you, say, want to control a motor, you may want to find a MotorControl Library: a collection of proceduresve already been written for yout you canuse withouving to do the dirty work of learning the nuanof motors.the Adafruit_PN532 library foler by placing it in yourard

10、uinosketchfolder/libraries folder. You may have to createthe librariebfolder if this is yourlibrary. You can read more about installing libraries in our tutorial.Restart the Arduino IDE. You should now be able to select File Exles Adafruit_PN532 readMifare sketch. Upload the sketch to your Arduino w

11、ired as in our tutorialTesting MiFarehe serial monitor, you should seet it found the PN532 chip. Then you can place your tag nearby and it will display the 4 byte ID code (this one is 0 xAE 0 x4C 0 xF0 0 x6C) and then theeger verof all four bytes together. You can use this number to identify each ca

12、rd. Recently NXP made so many cardst they actually ran through all 4 Bytes (232) so the number is not guaranteed to be absoluy unique. However, the chanare extremely slim you will have two cards with the same ID so as long as you arent using these cards for anything terribly important (like money tr

13、ansfer) its fine to use the number as a unique identifierLibrary 安裝方法 :For excomputer:le, this is the SerialLibrary, whichallowsthe Arduino tosend databack to theUsing LibrariesOne of the best features of the Arduino project is the ability to add on pre-crafted librariestadd hardware support. Theres

14、 tons of them, and you can pick and choose which to install.Theyre only loaded in when the sketch youre working on needs them, so for the most part you can download and stash them for future use.Sketches will often depend on libraries, you can see what they are by looking at the top of thesketch. If

15、 you see something like: Copy Code1. #include t meanst youll need a library called FatReader or a libraryt contains the file FatReader.If you donve it installed youll get an error:Whats in a library?A library is a folder with some files in it, the files will end in .cpp (C+ code file) and .h (C+head

16、er file).There may also be some .o files. The .o files are C+ compiled Objects. If you end up working onthe library and modifying it, be sure tete the .o files ast will force the Arduino IDE topile the modified .cppso fresh .os.Two optional files you may see are keywords.txt (this is a hs file tol t

17、he Arduino IDE how tocolorize your sketch and exshow up under the FileExles folder, whiay have some handy test-sketches. These willlesLibrary dropdown.Its important to remember!The structure of the library folder is very important! The .c and .h files must behe lowestlevel of folders. For exle, you

18、canve Arduino/libraries/WaveHC/WaveHC/file.c orArduino/libraries/MyLibraries/WaveHC/file.c - it must be Arduino/libraries/WaveHC/file.cHow to install librariesInArduinov16andear r,librarieswerestoredheArduinoInstallDirectory/hardware/libraries folder, which also contained all the built-in libraries(like Wire and Serial).In v17 and up, the user libraries are now storedhe ArduinoSketchDirectory/libraries folder.Y

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論