Switch between Huskylens Algorithms
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
Hi DFRobot Team,
for our actual Arduino robot car project, we use Huskylens as the car's camera. We need to detects Lines AND colored blocks (Obstacles) in our code and have not yet found out if this is possible.
We used the writeAlgorithm function to set the appropriate mode. However, this works only once in a program, we cannot switch to another mode while the program is running.
Is there a mode that can return both learned blocks and learned arrows?
Or a way to switch between line tracking and colored block detection?
We tried this (pseudocode):
void loop()
{
huskylens.writeAlgorithm(ALGORITHM_LINE_TRACKING);
if (huskylens.requestArrowsLearned())
{
…. // Do something
}
huskylens.writeAlgorithm(ALGORITHM_COLOR_RECOGNITION);
if (huskylens.requestBlocksLearned())
{
…. // Do something
}
… // Do something
}
If we start with Algorithm_line_tracking, we get learned line data, but the switch to color recognition does not work and we get no obstacle blocks data. If we switch the order and start with Algorithm_color_recognition, we get correct obstacle block data, but no more line data. How to solve this?
Best regards, Birgit
Thanks, the delay did the trick. However, we must use a much smaller delay, as we switch them during our car is actually driving. But 50ms seems to be sufficient.
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)