I want to trigger an event with my arduino code when Pixy2 detect a certain barcode and keep the event going for as long as the barcode is in sight.
if barcode 14 is detected then trigger event
while barcode 14 is being detected > loop
How do I do this?
My code:
#include <Pixy2.h>
Pixy2 pixy;
void setup()
{
Serial.begin(115200);
Serial.print(“Starting…\n”);
pixy.init();pixy.changeProg("line");
}
void loop()
{
int8_t i;
char buf[128];
pixy.line.getAllFeatures();
if (pixy.line.barcodes)
pixy.line.barcodes->print();
}
The serial monitor gives me: Barcode: (75 41), val: 14 flags: 2