my suggestion
bool DFRobot_GM60_IIC::begin(){
if(_pWire){
_pWire->begin();
_pWire->beginTransmission(_deviceAddr);
_pWire->write(0xaa);
byte error = _pWire->endTransmission();
communication=1;
if (error>0) {communication=0; return false;}
return DFRobot_GM60::begin();
} else return false;
}
then in main you can easy init the modul
//Init chip QR CODE SCANNER
if(gm60.begin()==true){
gm60.encode(gm60.eUTF8);
gm60.setupCode(/on =/true,/content=/true);
gm60.setIdentify(gm60.eEnableAllBarcode);
if(Serial_) Serial.println("Start to recognize");
}
my suggestion
bool DFRobot_GM60_IIC::begin(){
if(_pWire){
_pWire->begin();
_pWire->beginTransmission(_deviceAddr);
_pWire->write(0xaa);
byte error = _pWire->endTransmission();
communication=1;
if (error>0) {communication=0; return false;}
return DFRobot_GM60::begin();
} else return false;
}
then in main you can easy init the modul
//Init chip QR CODE SCANNER
if(gm60.begin()==true){
gm60.encode(gm60.eUTF8);
gm60.setupCode(/on =/true,/content=/true);
gm60.setIdentify(gm60.eEnableAllBarcode);
if(Serial_) Serial.println("Start to recognize");
}