问题描述
我将 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("]");
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)