Sending message from cell phone to PN532

Can you help me?
i work with PN532 AND Arduino uno, i cant sent a message from my cell phone to PN532, i using Adafruit library 1.3.3 and PN532 library,examples from the library and my own but nothing work, any idea?




#include <Wire.h>
#include <Adafruit_PN532.h>

// Crea una instancia del PN532 sin pasar el objeto Wire
Adafruit_PN532 nfc(SDA, SCL);

void setup() {
  // Inicializa la comunicación serial
  Serial.begin(115200);
  Serial.println("Inicializando PN532...");
  
  // Inicia la comunicación I2C con el PN532
  nfc.begin(); 
  
  // Obtiene la versión del firmware del PN532
  uint32_t versiondata = nfc.getFirmwareVersion();
  if (!versiondata) {
    Serial.println("No se detectó el PN532. Verifica las conexiones.");
    while (1); // Detiene el programa
  }

  // Muestra la versión del firmware del PN532
  Serial.print("PN532 Firmware Version: 0x");
  Serial.println(versiondata, HEX);
  
  // Configura el módulo para leer tarjetas NFC
  nfc.SAMConfig();
  Serial.println("Esperando una etiqueta NFC...");
}

void loop() {
  uint8_t success;
  uint8_t uid[] = {0};
  uint8_t uidLength;

  // Intenta leer una tarjeta NFC
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
  
  if (success) {
    // Etiqueta detectada, imprimir el UID y su longitud
    Serial.println("Etiqueta detectada:");
    
    // Mostrar la longitud del UID
    Serial.print("UID Length: ");
    Serial.print(uidLength, DEC);  // Longitud del UID en bytes
    Serial.println(" bytes");
    
    // Mostrar el UID en formato hexadecimal
    Serial.print("UID Value: ");
    for (uint8_t i = 0; i < uidLength; i++) {
      Serial.print(" 0x");
      Serial.print(uid[i], HEX);  // Imprimir cada byte del UID en formato hexadecimal
      if (i < uidLength - 1) {
        Serial.print(" ");  // Espacio entre los bytes, excepto al final
      }
    }
    Serial.println();  // Nueva línea para separación de las lecturas
    
    delay(1000); // Espera 1 segundo antes de intentar leer otra etiqueta
  } else {
    Serial.println("Esperando una etiqueta NFC...");
  }
}

I moved your topic to an appropriate forum category @proculture .

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.