admin管理员组文章数量:1405170
Below is the code, but in the serial monitor I'm getting the outputs camera is initialized, waiting, error
. The code in if loop Serial.read() == 'c'
is not getting executed. If anyone knows how to solve this and resolve the problem, I'm using an Arduino nano 33 BLE sense microcontroller.
code:-
#include <Arduino_OV767X.h>
long bytesPerFrame; // variable to hold total number of bytes in image
long numPixels;
// Declare a byte array to hold the raw pixels recieved from the OV7670
// Array size is set for QCIF; if other format requied, change size
// QCIF: 176x144 X 2 bytes per pixel (RGB565)
byte data[176 * 144 * 2];
void setup() {
Serial.begin(115200);
while (!Serial);
// Begin the OV7670 specifing resoultion (QCIF, Pixel format RGB565 and frames per second)
if (!Camera.begin(QCIF, RGB565, 1)) {
Serial.println("Failed to initialize camera!");
while (1);
}
bytesPerFrame = Camera.width() * Camera.height() * Camera.bytesPerPixel();
numPixels = Camera.width() * Camera.height();
Serial.println("initailesed camera");
// Optionally, enable the test pattern for testing
// If the next line is uncommented, the OV7670 will output a test pattern
//Camera.testPattern();
}
void loop() {
// Wait for a 'c' from Serial port before taking frame
Serial.println("waititng");
while (!Serial.available()) {
delay(10);
}
Serial.println("take wait");
if (Serial.read() == 'c') {
// Read frame from OV7670 into byte array
Camera.readFrame(data);
Serial.println("reading");
// Write out each byte of the array to the serial port
// Probaly a quicker way to do this
for (int i = 0; i < bytesPerFrame; i++){
Serial.write(data[i]);
}
Serial.println("completed");
// Write out a FF byte to tell receiving program that data is finished
// Somewhat dangerous - but has worked so far
delay(100);
Serial.write(0xFF);
}
Serial.print("error");
}
本文标签:
版权声明:本文标题:c - from OV7670 camera module without fifo memory is not getting the photo and input in serial monitor event though camera is in 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744237274a2596614.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论