Esp32 with qr sensor gm60

I´ve got a problem with my code and the hardware is a esp32 of 3 pins


tis is the esp that im using the pins are GIOP1 AND GIOP3 and already conect as i put in the code. The code didnt displays the qr lecture that i put to print en the monitor serial the sensor is this

/*!
 *@file detect_uart.ino
 *@brief get the qr code information
 *@details Scan QR codes continuously and serial output the information contained in codes.
 *@copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 *@license The MIT license (MIT)
 *@author [fengli](li.feng@dfrobot.com)
 *@version V1.0
 *@date 2021-6-29
 *@https://github.com/DFRobot/DFRobot_GM60
*/

#include <DFRobot_GM60.h>  // Incluir la biblioteca para interactuar con el módulo GM60
DFRobot_GM60_UART gm60;  // Crear una instancia del objeto GM60

/*Usar SoftwareSerial si usas UNO o NANO
#if ((defined ARDUINO_AVR_UNO) || (defined ARDUINO_AVR_NANO))
    #include <SoftwareSerial.h>
    SoftwareSerial Serial1(3, 1);  // RX, TX
    #define FPSerial Serial1
    
#else
    #define FPSerial Serial1
#endif*/

void setup() {
  // Configurar la comunicación serial
  #if (defined ESP32)
     Serial1.begin(9600, SERIAL_8N1, /*rx =*/T3, /*tx =*/T1);
  #else
  Serial1.begin(9600);  // Configurar a 9600 baudios para comunicación con el GM60
  #endif
  Serial.begin(115200);  // Configurar el puerto serial para la salida a la PC

  // Inicializar el módulo GM60
  gm60.begin(Serial1);
  
  // Restaurar a la configuración de fábrica si es necesario
  // gm60.reset();

  // Configurar el modo de codificación para eUTF8 (puedes cambiar a GBK si lo deseas)
  gm60.encode(gm60.eUTF8);

  // Configurar el módulo para que detecte y emita contenido del código QR
  gm60.setupCode(true, true);
  
  // Configurar el módulo para reconocer todos los tipos de códigos de barras, incluidos los QR
  gm60.setIdentify(gm60.eEnableAllBarcode);
  
  Serial.println("Start to recognize QR Codes...");
}

void loop() {
  // Esperar un segundo entre cada intento de escaneo
  delay(2000);
  
  // Detectar el contenido del código QR y devolverlo como una cadena de caracteres
  String qrCodeData = gm60.detection();
  
  // Si se detecta un código QR, mostrar los datos en el monitor serial
  if (qrCodeData.length() > 0) {
    Serial.print("QR Code Detected: ");
    Serial.println(qrCodeData);  // Imprimir los datos del QR en el monitor serial
  } else {
    Serial.println("No QR Code detected.");
  }
}

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