Giter VIP home page Giter VIP logo

esp32-pn532-micro's Introduction

esp32-pn532-micro

Contoh penerapan pn532 menggunakan platform micropyton pada board pn532

Kebutuhan perangkat

  • Reader NFC PN532
  • TAG NFC, bisa menggunakan kartu mifare
  • ESP32 controller

Rangkaian

Versi fritzing dapat Anda dapatkan di sini

Dari rangkaian di atas, mapping antara reader PN532 dan ESP32 adalah sebagai berikut

ESP32 PN532
5V VCC
GND GND
D18 (GPIO 18) SCK
D19 (GPIO 19) MISO
D23 (GPIO 23) MOSI
D5 (GPIO 5) SS

Contoh kode

import NFC_PN532 as nfc
from machine import Pin, SPI

# SPI
spi = SPI(1, baudrate=1000000, sck=Pin(18), mosi=Pin(23), miso=Pin(19))
cs = Pin(5, Pin.OUT)
cs.on()

# SENSOR INIT
pn532 = nfc.PN532(spi,cs)
ic, ver, rev, support = pn532.get_firmware_version()
print('Found PN532 with firmware version: {0}.{1}'.format(ver, rev))

# Configure PN532 to communicate with MiFare cards
pn532.SAM_configuration()

while True:
    print('Reading...')
    uid = pn532.read_passive_target(timeout=500)
    if uid is None:
        print('CARD NOT FOUND')
    else:
        numbers = [i for i in uid]
        string_ID = '{}-{}-{}-{}'.format(*numbers)
        print('Found card with UID:', [hex(i) for i in uid])
        print('Number_id: {}'.format(string_ID))

esp32-pn532-micro's People

Contributors

0d3ng avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zyp2015

esp32-pn532-micro's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.