Cov txheej txheem:

Txuag thiab Rov Ua Haujlwm Qhov Tseem Ceeb Nrog NFC (TfCD): 4 Cov Kauj Ruam
Txuag thiab Rov Ua Haujlwm Qhov Tseem Ceeb Nrog NFC (TfCD): 4 Cov Kauj Ruam

Video: Txuag thiab Rov Ua Haujlwm Qhov Tseem Ceeb Nrog NFC (TfCD): 4 Cov Kauj Ruam

Video: Txuag thiab Rov Ua Haujlwm Qhov Tseem Ceeb Nrog NFC (TfCD): 4 Cov Kauj Ruam
Video: Технический разговор TUDev с профессором Борой Озкан - Финтех и будущее финансов 2024, Hlis ntuj nqeg
Anonim
Image
Image
Sau Cov Khoom
Sau Cov Khoom

Peb xav sim seb nws ua haujlwm li cas txhawm rau kho qee qhov txiaj ntsig lossis teeb tsa thiab tom qab rov nco qab qhov teeb tsa no. Txog qhov kev sim no peb tau siv NFC lossis nyeem thiab tom qab ntawd khaws tus nqi ntawm nws. Tom qab ntawv tuaj yeem rov luam dua thiab xa tus nqi rov qab los kho qee qhov chaw. Txhawm rau ua kom muaj kev cuam tshuam peb tau siv Arduino Uno ua tus tswj thiab RGB LED lub nplhaib ua qhov hloov pauv. Nrog lub hwj chim potentiometer RGB hue tuaj yeem teeb tsa. Kev sib txuas lus ntawm Arduino thiab NFC lossis tau teeb tsa nrog daim npog NFC.

(Txoj haujlwm no yog kev tawm dag zog rau TU Delft, Kev Tsim Khoom Tsim Khoom, chav kawm: TfCD)

Kauj Ruam 1: Sau Cov Khoom

Peb siv rau txoj haujlwm no cov ntaub ntawv hauv qab no:

- Arduino uno- NFC shield & tag (https://www.elecrow.com/wiki/index.php?title=NFC_Shield)- Mokugi t-WS2812B-8LED- Potentiometer (10 3B 42 5V)- Hloov -10K Ohm resistor - (Daim ntawv qhia zaub mov)

Kauj Ruam 2: Siv Potentiometer los Kho RGB LED

Siv Potentiometer los kho RGB LED
Siv Potentiometer los kho RGB LED
Siv Potentiometer los kho RGB LED
Siv Potentiometer los kho RGB LED

Ua ntej kom paub tseeb tias LED koj tab tom ua haujlwm nrog kev ua haujlwm, los ntawm kev siv lwm qhov kev ntsuas tus lej. Koj tuaj yeem txuas lub hwj chim ntsuas kom kho RGB ntawm LED. Rau qhov no tsim lub Circuit Court raws li qhia hauv daim duab. Txuas mus rau lub zog (5V) thiab hauv av, thiab txuas lub zog hluav taws xob rau tus pin A0.

Yog tias koj xav ntsuas tus qauv thiab tom qab txuag ntau qhov sib txawv koj tuaj yeem siv ntau lub zog ntxiv ntawm cov kauj ruam no.

Cov cai rau qhov kev xeem no kuj tau txuas nrog. Txhawm rau kom tau txais txoj cai ua haujlwm koj yuav tsum rub lub tsev qiv ntawv Adafruit_NeoPixel.h.

Peb sib xyaw cov xim ntawm RGB LED raws li hauv qab no: Peb tau xaiv tas li kom muaj xim liab thiab kho nws kom ntshav los ntawm kev sib xyaw xim xiav. peb daim ntawv qhia kev nyeem ntawv ntawm lub ntsuas cua:

void ReadPot () {val = analogRead (lauj kaub); val = daim ntawv qhia (val, 0, 1023, 0, 255);

Txhawm rau zam kom tsis txhob ploj ntawm cov tswv yim tus nqi ntawm lub zog, peb tsuas yog hloov tus nqi tshiab ntawm xiav LED, thaum qhov sib txawv ntawm qhov tam sim no thiab yav dhau los potvalue siab txaus:

int diff = abs (val-oldVal);

if (diff> TOLERANCE) {ChangeLED ();

Kauj Ruam 3: Sib koom NFC

Kev koom ua ke NFC
Kev koom ua ke NFC
Kev koom ua ke NFC
Kev koom ua ke NFC

Cov kauj ruam tom ntej yog ua ke NFC. Ua ntej txuas NFC daim thaiv rau Arduino.

Kuj ntxiv qhov hloov pauv raws li qhia hauv cov duab. Qhov hloov pauv tau siv los hloov pauv ntawm kev nyeem ntawv thiab sau ntawv mus rau NFC lossis.

Rub lub tsev qiv ntawv PN532.h rau daim npog NFC. Cov lej txuas nrog yog kev hloov pauv ntawm cov piv txwv piv txwv muab hauv lub tsev qiv ntawv. Nws tau hloov pauv txoj hauv kev uas RGB tus nqi ntawm LED tau hloov pauv.

Koj kuj tseem tuaj yeem kuaj thawj zaug tsuas yog nyeem lossis sau ntawv nrog ob tus lej uas tau muab cais cais.

Piav qhia zaum kawg

Ua ntej txhua qhov siv tau hloov pauv tau pib.

Tom qab ntawd hauv qhov tsis muaj teeb tsa kev sib txuas nfc tau teeb tsa.

Lub voj void pib nrog nyeem lub xeev ntawm qhov hloov.

Case 0 yog thaum lub xeev khawm yog HIGH. Hauv qhov no thawj qhov ua haujlwm Nyeem Ntawv () hu ua. Qhov no nyeem RGB tus nqi tau txais kev cawmdim hauv ntu 8 ntawm NFC tag ntawm thawj qhov chaw ntawm kab ntawv (Blue = block [0];). Tom qab ntawd ua haujlwm ChangeLEDRead () yog hu ua, uas hloov qhov hue ntawm LED rau tus nqi, uas nyuam qhuav nyeem los ntawm NFC lossis.

Case 1 yog thaum lub xeev khawm yog LOW. Hauv qhov no ua ntej ua haujlwm ReadPot () yog hu ua, uas txhais tau tias tam sim no koj tuaj yeem tuaj yeem kho tus hue ntawm LEDs nrog lub hwj chim. Cov tswv yim no los ntawm lub ntsuas hluav taws xob yog tom qab ntawd teeb tsa tus nqi nruab nrab ntawm 0 thiab 255. Kev ua haujlwm ChangeLEDPot () tom qab ntawd tswj cov xim LED siv cov tswv yim los ntawm lub ntsuas hluav taws xob. Hauv qhov no kuj tseem muaj nuj nqi Sau () hu ua. Qhov no ua kom ntseeg tau tias sai li sai tau thaum NFC tag tau muab tso ze rau ntawm daim ntaub thaiv tam sim no tus nqi ntawm xiav yuav raug sau rau ntawm nws hauv thawj qhov chaw ntawm thaiv 8.

Kauj Ruam 4: Tau Txais Kev Hloov Kho

Tib txoj cai kuj tseem tuaj yeem siv rau lwm qhov xwm txheej thiab tsis tsuas yog txwv rau NFC.

Xav txog piv txwv txog qhov chaw ua haujlwm sib koom, qhov uas koj kho qhov siab ntawm koj lub rooj zaum, lub nraub qaum thiab lub siab ntawm lub rooj rau koj tus kheej nyiam. Koj txuag koj qhov kev nyiam los ntawm kev tshuaj xyuas sai nrog NFC lossis. Thaum koj rov qab los lwm hnub koj luam koj daim ntawv ntxiv, thiab qhov chaw ua haujlwm hloov pauv rau koj qhov chaw.

Hloov chaw ntawm NFC nti, koj tseem tuaj yeem siv koj lub xov tooj smartphone. Ib daim ntawv thov tshwj xeeb lossis lub vev xaib tuaj yeem siv ua interface.

Lwm qhov kev siv yuav yog piv txwv los luam theej duab cov ntiv tes es tsis txhob luam NFC lossis. Cov ntiv tes tuaj yeem txuas nrog rau qee tus neeg siv profile uas nyiam tau txais kev cawmdim.

Pom zoo: