Git Product home page Git Product logo

Comments (5)

felmue avatar felmue commented on August 20, 2024

Hello @openmotion

have you adapted the ReadTag example to use the proper GPIOs for RX and TX? By default the example uses Serial1 which by default uses GPIO3 and GPIO1 for RX and TX. However on M5Paper different GPIOs are used on port C (UART). Check the sticker on the back of your M5Paper.

Good luck!

Thanks
Felix

from m5epd.

openmotion avatar openmotion commented on August 20, 2024

on the sticker i have : G, 5V TXT, G18, G19
how can i adapt the code ?
i tried with :
Serial1.begin(9600, SERIAL_8N1, 18, 19);

but no change ...
the full code :

`#include <NfcAdapter.h>
#include <PN532/PN532/PN532.h>
#include <M5EPD.h>
#include "driver/gpio.h"
#include "driver/adc.h"

#include <PN532/PN532_HSU/PN532_HSU.h>

//HardwareSerial Serial1(1);

PN532_HSU pn532hsu(Serial1);
NfcAdapter nfc(pn532hsu);

void setup(void) {
M5.begin();
Serial1.println("NDEF begin");
delay(5000);
Serial1.begin(9600);

//Wire.begin(18, 19);

Serial1.println("NDEF Reader");
nfc.begin();

}

void loop(void) {
SERIAL.println("\nScan a NFC tag\n");
if (nfc.tagPresent()) {
NfcTag tag = nfc.read();
tag.print();
}
//delay(5000);
M5.update();
delay(100);
}`

from m5epd.

openmotion avatar openmotion commented on August 20, 2024

another test

`#include <NfcAdapter.h>
#include <PN532/PN532/PN532.h>
#include <M5EPD.h>

#include <PN532/PN532_SWHSU/PN532_SWHSU.h>
#include "SoftwareSerial.h"
//HardwareSerial Serial1(1);
SoftwareSerial SWSerial(19, 18);
PN532_SWHSU pn532swhsu(SWSerial);
NfcAdapter nfc(pn532swhsu);

void setup(void) {
M5.begin();
Serial1.println("NDEF begin");
//delay(5000);
Serial1.begin(9600);
Serial1.println("NDEF Reader");
nfc.begin();
}

void loop(void) {
SERIAL.println("\nScan a NFC tag\n");
if (nfc.tagPresent()) {
NfcTag tag = nfc.read();
tag.print();
}
//delay(5000);
M5.update();
delay(100);
}`

from m5epd.

felmue avatar felmue commented on August 20, 2024

Hello @openmotion

sorry, I am not sure myself how this can be achieved with the NFC library. But I think you'll find a hint here.

Check out section "Step 5. Modify the code as below to enable UART communication." but try SoftwareSerial with the correct GPIOs.

Sorry I am not more of a help - but I lack the necessary hardware to try it out myself.

Good luck!
Felix

from m5epd.

openmotion avatar openmotion commented on August 20, 2024

thanks @felmue

i tried this method but no luck

`#include <NfcAdapter.h>
#include <PN532/PN532/PN532.h>
#include <M5EPD.h>

#include <PN532/PN532_SWHSU/PN532_SWHSU.h>
#include "SoftwareSerial.h"
//HardwareSerial Serial1(1);

#define RX_PIN 18
#define TX_PIN 19
#define BAUD_RATE 57600
SoftwareSerial SWSerial(18, 19);
PN532_SWHSU pn532swhsu(SWSerial);
NfcAdapter nfc(pn532swhsu);

void setup(void) {
M5.begin();
Serial1.println("NDEF begin");
//delay(5000);
Serial1.begin(9600, SWSERIAL_8N1,RX_PIN, TX_PIN);
// Serial1.begin(BAUD_RATE, RX_PIN, TX_PIN, SWSERIAL_8N1, false, 95, 11);
Serial1.println("NDEF Reader");
nfc.begin();
}

void loop(void) {
SERIAL.println("\nScan a NFC tag\n");
if (nfc.tagPresent()) {
NfcTag tag = nfc.read();
tag.print();
}
//delay(5000);
M5.update();
delay(100);
}`

from m5epd.

Related Issues (20)

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.