The HuskyLens is an easy-to-use AI camera module that provides powerful machine learning capabilities to any project. It is designed to interface with microcontrollers such as the Arduino UNO, enabling applications in robotics, automation, and interactive art. With its ability to perform tasks such as facial recognition, object tracking, and color detection, the HuskyLens is a versatile component for hobbyists and professionals alike.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground connection |
3 | TX | UART transmit |
4 | RX | UART receive |
5 | SCL | I2C clock |
6 | SDA | I2C data |
#include <SoftwareSerial.h>
#include "HUSKYLENS.h"
SoftwareSerial huskyLensSerial(2, 3); // RX, TX
HUSKYLENS huskyLens;
void setup() {
huskyLensSerial.begin(9600);
huskyLens.begin(huskyLensSerial);
Serial.begin(9600);
}
void loop() {
if (!huskyLens.request()) {
Serial.println("Failed to request data from HUSKYLENS, check the connection!");
} else {
while (huskyLens.available()) {
// Print result if object is recognized
HUSKYLENSResult result = huskyLens.read();
if (result.command == COMMAND_RETURN_BLOCK) {
Serial.print("ID: ");
Serial.print(result.id);
Serial.print(" X Center: ");
Serial.print(result.xCenter);
Serial.print(" Y Center: ");
Serial.println(result.yCenter);
}
}
}
}
Note: This example assumes the use of the SoftwareSerial library to communicate with the HuskyLens. Adjust the pin numbers in the SoftwareSerial huskyLensSerial(2, 3);
line to match your setup.
Remember to keep code comments concise and within the 80 character line length limit. Wrap comments as needed for clarity and readability.