0

我将 Lepton 3.5 连接到 Adafruit ESP32 Feather,并使用了附加在 Arduino 中的这段代码。所以我的问题包括读取相机的帧。使用此代码,我无法在串行监视器上获得任何结果,但如果我删除条件“if (flirController.readNextFrame())”,串行监视器会不断向我显示第一帧的结果,而不是向我显示结果不断。

我已经改变了波特率和时钟,但结果是一样的。

#include "LeptonFLiR.h"
//#include "digitalWriteFast.h"
#include <Wire.h>
const byte flirCSPin = 22;
LeptonFLiR flirController(Wire, flirCSPin); // Library using Wire1 and chip select pin D22

// Fast CS enable/disable routines, using the digitalWriteFast library
static void fastEnableCS(byte pin) { digitalWrite(22, LOW); }
static void fastDisableCS(byte pin) { digitalWrite(22, HIGH); }

void setup() {
Serial.begin(115200);

Wire.begin();                      // Wire1 must be started first
Wire.setClock(15000);             // Supported baud rates are 100kHz, 400kHz, and 1000kHz
SPI.begin();                        // SPI must be started first as well

// Using default memory allocation mode 80x60 16bpp and default celsius temperature mode
flirController.init();

// Setting use of fast enable/disable methods for chip select
flirController.setFastCSFuncs(fastEnableCS, fastDisableCS);

flirController.sys_setTelemetryEnabled(ENABLED); // Ensure telemetry is enabled
}

void loop() {
if (flirController.readNextFrame()) { // Read next frame and store result into internal imageData
// Find the hottest spot on the frame

    int hotVal = 0, hotX, hotY;

    for (int y = 0; y < flirController.getImageHeight(); ++y) {
        for (int x = 0; x < flirController.getImageWidth(); ++x) {
            int val = flirController.getImageDataRowCol(y, x);

            if (val > hotVal) {
                hotVal = val;
                hotX = x; hotY = y;
            }
        }
    }

    Serial.print("Hottest point: [");
    Serial.print(hotX);
    Serial.print(",");
    Serial.print(hotY);
    Serial.println("]");
}
}
4

0 回答 0