HuskyLens is an easy-to-use AI machine vision sensor. It is equipped with multiple functions, such as face recognition, object tracking, object recognition, line tracking, color recognition, and tag(QR code) recognition.
#42502
Hi, please note that the ability to trigger learning through software is not yet available.
The release will be updated in the new feature in about one month, and now, the learning triggering can only be realized by button press.
#43434
etothex23 wrote:
Sun Jun 28, 2020 2:35 pm
Hello,
I need to be able to trigger the learning button with code. How is this done? Are you going to update the library or can you point me to figuring out how to trigger the learning button?
You should be able to trigger a learn action by issuing a COMMAND_REQUEST_LEARN (0x36) command with the huskylens.writeLearn() call in Arduino. See Protocol.

See this arduino example:
Code: Select all
#include "HUSKYLENS.h"

HUSKYLENS huskylens;

void setup() 
{
    Serial.begin(115200);
    pinMode(A0,INPUT_PULLUP);
    Wire.begin();
    while (!huskylens.begin(Wire))
    {
        Serial.println(F("Begin failed!"));
        delay(100);
    }
}

void loop() 
{
  if(digitalRead(A0) == 0)
  {
     while (!huskylens.writeLearn(1))  // bool writeLearn(int ID)
    {
      Serial.println(F("learn object ID1 failed!")); 
      delay(100);
    }
    Serial.println(F("learn object ID1 success")); 
  }
}
Each time you'll ground the A0 pin in this example, the Huskylens will learn a new image for ID1. You can adapt the code to learn multiple classes (by using more pins for example). At the end, save the model to SD card to keep it for example.