Reference

The article offers an in-depth look at the DFRobot GM60 QR code scanner API, covering initialization, encoding options, setup configurations, QR code recognition types, factory reset, and communication protocols (UART and I2C), providing essential information for effective scanner utilization.

API Description


  /**
   * @fn DFRobot_GM60
   * @brief Constructor 
   */
  DFRobot_GM60();
  
  /**
   * @fn begin
   * @brief Init chip
   * @return Boolean type, Indicates the initialization result
   * @retval true The setting succeeded
   * @retval false Setting failed
   */
  bool begin();
  
  /**
   * @fn encode
   * @brief Read the data encoding mode
   * @param encode Encoding mode
                   eGBK,  //gbk encoding
                   eUTF8, //utf8 encoding
   * @return Boolean type, the result of seted
   * @retval true The setting succeeded
   * @retval false Setting failed
  */
  bool encode(eEncode_t encode);
  
  /**
   * @fn setupCode
   * @brief Set code config, the value of chip register can be changed by using the module to scan QR code
   * @param on true (Enable setting code)/false (Disable setting code)
   * @param content true (Output the set code content)/false (Not output the set code content)
   * @return Boolean type, the result of seted
   * @retval true The setting succeeded
   * @retval false Setting failed
  */
  bool setupCode(bool on,bool content);
  
  /**
   * @fn setIdentify
   * @brief Set the available types of QR code for recognition
   * @param berCode 
            eForbidAllBarcode, //Forbid all the QR code recognition
            eEnableAllBarcode, // Enable all the QR code recognition
            eEnableDefaultcode, // Enable the default QR code recognition
   * @return Boolean type, the result of seted
   * @retval true The setting succeeded
   * @retval false Setting failed
  */
  bool setIdentify(eBarCode_t berCode);
  
  /**
   * @fn reset
   * @brief Restore to factory settings
   * @return Boolean type, the result of seted
   * @retval true The setting succeeded
   * @retval false Setting failed
  */
  bool reset();
  
   /**
   * @fn detection
   * @brief Detect the data contained in the scanned QR code
   * @return  return the scanned data as a character string
   */
  String detection();

Communication Protocol Description

The scanner supports UART and I2C communication. For UART, the baud rate is 9600. For I2C, the address is 0x1A.

Was this article helpful?

TOP