how to change the name ID while using uart mode?
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
here is the code that im using.
#include "HUSKYLENS.h"
#include "SoftwareSerial.h"
// Create HuskyLens object
HUSKYLENS huskylens;
SoftwareSerial mySerial(12, 11); // RX, TX
//HUSKYLENS green line >> Pin 10; blue line >> Pin 11
void printResult(HUSKYLENSResult result);
void setNewName (String newname, uint8_t ID) {
while (!huskylens.setCustomName(newname, ID))
{
Serial.println(F("Custom name failed!"));
delay(100);
}
}
void setup()
{
Serial.begin(115200);
mySerial.begin(9600);
while (!huskylens.begin(mySerial))
{
Serial.println(F("Begin failed!"));
Serial.println(F("1.Please recheck the \"Protocol Type\" in HUSKYLENS (General Settings>>Protocol Type>>Serial 9600)"));
Serial.println(F("2.Please recheck the connection."));
delay(100);
}
// Short delay to let HuskyLens stabilize
delay(100);
// Change detected face names
setNewName ("John", 1);
}
void loop() {
if (!huskylens.request()) Serial.println(F("Fail to request data from HUSKYLENS, recheck the connection!"));
else if(!huskylens.isLearned()) Serial.println(F("Nothing learned, press learn button on HUSKYLENS to learn one!"));
else if(!huskylens.available()) Serial.println(F("No block or arrow appears on the screen!"));
else
{
Serial.println(F("###########"));
while (huskylens.available())
{
HUSKYLENSResult result = huskylens.read();
printResult(result);
}
}
}
void printResult(HUSKYLENSResult result){
if (result.command == COMMAND_RETURN_BLOCK){
Serial.println(String()+F("Block:xCenter=")+result.xCenter+F(",yCenter=")+result.yCenter+F(",width=")+result.width+F(",height=")+result.height+F(",ID=")+result.ID);
}
else if (result.command == COMMAND_RETURN_ARROW){
Serial.println(String()+F("Arrow:xOrigin=")+result.xOrigin+F(",yOrigin=")+result.yOrigin+F(",xTarget=")+result.xTarget+F(",yTarget=")+result.yTarget+F(",ID=")+result.ID);
}
else{
Serial.println("Object unknown!");
}
}