Book Image

Near Field Communication with Android Cookbook

By : Subtil
Book Image

Near Field Communication with Android Cookbook

By: Subtil

Overview of this book

An easy-to-follow guide, full of hands-on examples of and real-world applications. Each recipe is explained and placed in context. If you want to learn how to create NFC-enabled Android applications, this is the book for you. Perhaps you already know a bit about Android application developments but have never used NFC, or perhaps you know a little about NFC android development but want some more advanced features and examples. In either case, this book will get you up and running quickly. You are expected to have Android programming knowledge.
Table of Contents (12 chapters)
11
Index

Controlling hotel room access with Arduino and NFC – Part 2


In this recipe, we create an Arduino application that will read the encrypted data from the NFC card and compare it with the room number it has been configured to.

Getting ready

We assume that an Arduino ship has been connected properly with an Adafruit NFC shield and that the Arduino software and drivers are correctly installed and working.

How to do it...

We will retrieve the data from the tag and compare it with the encrypted room number:

  1. Download the arduino_NFC library from https://github.com/odopod/arduino_NFC.

  2. Download AESLib from https://github.com/DavyLandman/AESLib.

  3. Download the arduino-base64 library from https://github.com/adamvr/arduino-base64.

  4. Navigate to the Arduino software installation directory and extract both downloaded libraries to the folder libraries.

  5. Open the Arduino software and create a new script. Navigate to Sketch | Import Library…, where both libraries should be present as shown in the following screenshot...