NachtRaveVL / Lepton-FLiR-Arduino

Arduino Library for the Lepton FLiR Thermal Camera Module.
MIT License
59 stars 17 forks source link

Can't read the Lepton 3.5 frames using ESP32 #12

Closed GoncaloRodrigues241 closed 3 years ago

GoncaloRodrigues241 commented 3 years ago

Hello!

I connected Lepton 3.5 to Adafruit ESP32 Feather and I used this code attached in Arduino. So my problem consists of reading the frames of the camera. With this code, I can't have any results on Serial Monitor, but if I remove the condition "if (flirController.readNextFrame())", the Serial Monitor is constantly showing me the results of the first frame, instead of showing me the results continuously.

I have already changed the baudrate and the clock but the results are the same.

include "LeptonFLiR.h"

//#include "digitalWriteFast.h"

include

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("]");

} }

NachtRaveVL commented 3 years ago

duplicate to #8