Hello,
I'm helping my son with a project, and got stuck trying to use an Adafruit IR camera.
We gor the camera is AMG88xx GridEYE 8x8 IR camera runing fine, but we want to know if there is a value less than 10 inside the array to trigger a different action.
We can trigger the next step with a simple nested if, however, we dont know how to pull/compare the data from the array.
Basically...
if (any value inside the array <= 10) {
Serial.println("LESS THAN 10");
delay(1000);
}
else Serial.println("MORE THAN 10");
delay(100);
return;
This is how the array looks like
[19.50, 19.50, 19.00, 19.00, 19.00, 18.75, 19.25, 18.50,
19.50, 19.75, 19.50, 19.50, 19.50, 19.50, 19.50, 19.25,
19.50, 19.75, 19.50, 19.50, 19.00, 19.25, 19.25, 19.25,
19.50, 19.50, 18.75, 19.25, 19.75, 19.75, 20.00, 19.25,
19.25, 19.75, 19.75, 19.50, 19.25, 19.50, 19.25, 18.75,
19.25, 19.25, 19.00, 19.00, 19.25, 19.25, 18.75, 19.00,
19.00, 19.50, 19.50, 19.00, 19.00, 19.25, 18.50, 18.25,
19.50, 19.00, 18.75, 19.25, 18.75, 18.75, 18.75, 18.50,
]
And here is the code:
#include <Wire.h>
#include <Adafruit_AMG88xx.h>
Adafruit_AMG88xx amg;
float pixels[AMG88xx_PIXEL_ARRAY_SIZE];
void setup() {
Serial.begin(9600);
bool status;
// default settings
status = amg.begin();
if (!status) {
Serial.println("Could not find a valid AMG88xx sensor, check wiring!");
while (1)
;
}
}
void loop() {
//read all the pixels
amg.readPixels(pixels);
Serial.print("[");
for (int i = 1; i <= AMG88xx_PIXEL_ARRAY_SIZE; i++) {
Serial.print(pixels[i - 1]);
Serial.print(", ");
if (i % 8 == 0) Serial.println();
}
Serial.println("]");
Serial.println();
//delay a second
delay(1000);
}
We appreciate any help from the community.
Thanks.
4 posts - 3 participants