Open beratyil opened 4 years ago
This is the code. // ArduCAM Mini demo (C)2017 Lee // Web: http://www.ArduCAM.com // This program is a demo of how to use most of the functions // of the library with ArduCAM Mini camera, and can run on any Arduino platform. // This demo was made for ArduCAM_Mini_5MP_Plus. // It needs to be used in combination with PC software. // It can test OV2640 functions // This program requires the ArduCAM V4.0.0 (or later) library and ArduCAM_Mini_5MP_Plus // and use Arduino IDE 1.6.8 compiler or above
//This demo can only work on OV2640_MINI_2MP platform.
const char bmp_header[BMPIMAGEOFFSET] PROGMEM = { 0x42, 0x4D, 0x36, 0x58, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x58, 0x02, 0x00, 0xC4, 0x0E, 0x00, 0x00, 0xC4, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00 }; // set pin 7 as the slave select for the digital pot: const int CS = 5; const int SD_CS = 4; const int cs_lora = 7; int counter = 0; bool is_header = false; int mode = 0; uint8_t start_capture = 0;
ArduCAM myCAM( OV2640, CS );
ArduCAM myCAM( OV5642, CS );
uint8_t read_fifo_burst(ArduCAM myCAM); //----------------------------------------------------- void setup() { // put your setup code here, to run once: uint8_t vid, pid; uint8_t temp;
Wire.begin(); Serial.begin(9600);
Wire.begin(); Serial.begin(115200);
Serial.println(F("ACK CMD ArduCAM Start! END"));
// set the CS as an output: pinMode(cs_lora, OUTPUT); digitalWrite(cs_lora, HIGH); pinMode(CS, OUTPUT); digitalWrite(CS, HIGH);
// initialize SPI:
SPI.begin();
//Reset the CPLD
myCAM.write_reg(0x07, 0x80);
delay(100);
myCAM.write_reg(0x07, 0x00);
delay(100);
while(1){
//Check if the ArduCAM SPI bus is OK
myCAM.write_reg(ARDUCHIP_TEST1, 0x55);
temp = myCAM.read_reg(ARDUCHIP_TEST1);
if (temp != 0x55){
Serial.println(F("ACK CMD SPI interface Error! END"));
delay(1000);continue;
}else{
Serial.println(F("ACK CMD SPI interface OK. END"));break;
}
}
Serial.println("LoRa Sender");
while(1)
{
if (!LoRa.begin(915E6))
{
Serial.println("Starting LoRa failed!");
continue;
}
else
{
Serial.println("LoRa OK.");
break;
}
}
while(1){ //Check if the camera module type is OV2640 myCAM.wrSensorReg8_8(0xff, 0x01); myCAM.rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid); myCAM.rdSensorReg8_8(OV2640_CHIPID_LOW, &pid); if ((vid != 0x26 ) && (( pid != 0x41 ) || ( pid != 0x42 ))){ Serial.println(F("ACK CMD Can't find OV2640 module! END")); delay(1000);continue; } else{ Serial.println(F("ACK CMD OV2640 detected. END"));break; } }
while(1){ //Check if the camera module type is OV5642 myCAM.wrSensorReg16_8(0xff, 0x01); myCAM.rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid); myCAM.rdSensorReg16_8(OV5642_CHIPID_LOW, &pid); if((vid != 0x56) || (pid != 0x42)){ Serial.println(F("ACK CMD Can't find OV5642 module! END")); delay(1000);continue; } else{ Serial.println(F("ACK CMD OV5642 detected. END"));break; } }
//Change to JPEG capture mode and initialize the OV5642 module myCAM.set_format(JPEG); myCAM.InitCAM();
myCAM.OV2640_set_JPEG_size(OV2640_320x240);
myCAM.write_reg(ARDUCHIP_TIM, VSYNC_LEVEL_MASK); //VSYNC is active HIGH myCAM.OV5642_set_JPEG_size(OV5642_320x240);
delay(1000); myCAM.clear_fifo_flag();
myCAM.write_reg(ARDUCHIP_FRAMES,0x00);
} //--------------------------------------------------------- void loop() { // put your main code here, to run repeatedly: uint8_t temp = 0xff, temp_last = 0; bool is_header = false; LoRa.beginPacket();
LoRa.print(": ");
LoRa.println(counter);
if (Serial.available()) { temp = Serial.read(); switch (temp) { case 0: myCAM.OV2640_set_JPEG_size(OV2640_160x120);delay(1000); Serial.println(F("ACK CMD switch to OV2640_160x120 END")); temp = 0xff; break; case 1: myCAM.OV2640_set_JPEG_size(OV2640_176x144);delay(1000); Serial.println(F("ACK CMD switch to OV2640_176x144 END")); temp = 0xff; break; case 2: myCAM.OV2640_set_JPEG_size(OV2640_320x240);delay(1000); Serial.println(F("ACK CMD switch to OV2640_320x240 END")); temp = 0xff; break; case 3: myCAM.OV2640_set_JPEG_size(OV2640_352x288);delay(1000); Serial.println(F("ACK CMD switch to OV2640_352x288 END")); temp = 0xff; break; case 4: myCAM.OV2640_set_JPEG_size(OV2640_640x480);delay(1000); Serial.println(F("ACK CMD switch to OV2640_640x480 END")); temp = 0xff; break; case 5: myCAM.OV2640_set_JPEG_size(OV2640_800x600);delay(1000); Serial.println(F("ACK CMD switch to OV2640_800x600 END")); temp = 0xff; break; case 6: myCAM.OV2640_set_JPEG_size(OV2640_1024x768);delay(1000); Serial.println(F("ACK CMD switch to OV2640_1024x768 END")); temp = 0xff; break; case 7: myCAM.OV2640_set_JPEG_size(OV2640_1280x1024);delay(1000); Serial.println(F("ACK CMD switch to OV2640_1280x1024 END")); temp = 0xff; break; case 8: myCAM.OV2640_set_JPEG_size(OV2640_1600x1200);delay(1000); Serial.println(F("ACK CMD switch to OV2640_1600x1200 END")); temp = 0xff; break; case 0x10: mode = 1; temp = 0xff; start_capture = 1; Serial.println(F("ACK CMD CAM(0x10) start single shoot. END")); break; case 0x11: temp = 0xff; myCAM.set_format(JPEG); myCAM.InitCAM();
myCAM.set_bit(ARDUCHIP_TIM, VSYNC_LEVEL_MASK);
#endif
break;
case 0x20:
mode = 2;
temp = 0xff;
start_capture = 2;
Serial.println(F("ACK CMD CAM start video streaming. END"));
break;
case 0x30:
mode = 3;
temp = 0xff;
start_capture = 3;
Serial.println(F("ACK CMD CAM start single shoot. END"));
break;
case 0x31:
temp = 0xff;
myCAM.set_format(BMP);
myCAM.InitCAM();
#if !(defined (OV2640_MINI_2MP))
myCAM.clear_bit(ARDUCHIP_TIM, VSYNC_LEVEL_MASK);
#endif
myCAM.wrSensorReg16_8(0x3818, 0x81);
myCAM.wrSensorReg16_8(0x3621, 0xA7);
break;
case 0x40:
myCAM.OV2640_set_Light_Mode(Auto);temp = 0xff;
Serial.println(F("ACK CMD Set to Auto END"));break;
case 0x41:
myCAM.OV2640_set_Light_Mode(Sunny);temp = 0xff;
Serial.println(F("ACK CMD Set to Sunny END"));break;
case 0x42:
myCAM.OV2640_set_Light_Mode(Cloudy);temp = 0xff;
Serial.println(F("ACK CMD Set to Cloudy END"));break;
case 0x43:
myCAM.OV2640_set_Light_Mode(Office);temp = 0xff;
Serial.println(F("ACK CMD Set to Office END"));break;
case 0x44:
myCAM.OV2640_set_Light_Mode(Home); temp = 0xff;
Serial.println(F("ACK CMD Set to Home END"));break;
case 0x50:
myCAM.OV2640_set_Color_Saturation(Saturation2); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+2 END"));break;
case 0x51:
myCAM.OV2640_set_Color_Saturation(Saturation1); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+1 END"));break;
case 0x52:
myCAM.OV2640_set_Color_Saturation(Saturation0); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+0 END"));break;
case 0x53:
myCAM. OV2640_set_Color_Saturation(Saturation_1); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation-1 END"));break;
case 0x54:
myCAM.OV2640_set_Color_Saturation(Saturation_2); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation-2 END"));break;
case 0x60:
myCAM.OV2640_set_Brightness(Brightness2); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+2 END"));break;
case 0x61:
myCAM.OV2640_set_Brightness(Brightness1); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+1 END"));break;
case 0x62:
myCAM.OV2640_set_Brightness(Brightness0); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+0 END"));break;
case 0x63:
myCAM. OV2640_set_Brightness(Brightness_1); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness-1 END"));break;
case 0x64:
myCAM.OV2640_set_Brightness(Brightness_2); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness-2 END"));break;
case 0x70:
myCAM.OV2640_set_Contrast(Contrast2);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+2 END"));break;
case 0x71:
myCAM.OV2640_set_Contrast(Contrast1);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+1 END"));break;
case 0x72:
myCAM.OV2640_set_Contrast(Contrast0);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+0 END"));break;
case 0x73:
myCAM.OV2640_set_Contrast(Contrast_1);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast-1 END"));break;
case 0x74:
myCAM.OV2640_set_Contrast(Contrast_2);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast-2 END"));break;
case 0x80:
myCAM.OV2640_set_Special_effects(Antique);temp = 0xff;
Serial.println(F("ACK CMD Set to Antique END"));break;
case 0x81:
myCAM.OV2640_set_Special_effects(Bluish);temp = 0xff;
Serial.println(F("ACK CMD Set to Bluish END"));break;
case 0x82:
myCAM.OV2640_set_Special_effects(Greenish);temp = 0xff;
Serial.println(F("ACK CMD Set to Greenish END"));break;
case 0x83:
myCAM.OV2640_set_Special_effects(Reddish);temp = 0xff;
Serial.println(F("ACK CMD Set to Reddish END"));break;
case 0x84:
myCAM.OV2640_set_Special_effects(BW);temp = 0xff;
Serial.println(F("ACK CMD Set to BW END"));break;
case 0x85:
myCAM.OV2640_set_Special_effects(Negative);temp = 0xff;
Serial.println(F("ACK CMD Set to Negative END"));break;
case 0x86:
myCAM.OV2640_set_Special_effects(BWnegative);temp = 0xff;
Serial.println(F("ACK CMD Set to BWnegative END"));break;
case 0x87:
myCAM.OV2640_set_Special_effects(Normal);temp = 0xff;
Serial.println(F("ACK CMD Set to Normal END"));break;
}
}
if (mode == 1)
{
if (start_capture == 1)
{
myCAM.flush_fifo();
myCAM.clear_fifo_flag();
//Start capture
myCAM.start_capture();
start_capture = 0;
}
if (myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK))
{
Serial.println(F("ACK CMD CAM Capture Done. END"));delay(50);
read_fifo_burst(myCAM);
//Clear the capture done flag
myCAM.clear_fifo_flag();
LoRa.println("--------------------------------------------------------------------------");
LoRa.endPacket();
counter++;
delay(1000);
}
}
else if (mode == 2)
{
while (1)
{
temp = Serial.read();
if (temp == 0x21)
{
start_capture = 0;
mode = 0;
Serial.println(F("ACK CMD CAM stop video streaming. END"));
break;
}
switch (temp)
{
case 0x40:
myCAM.OV2640_set_Light_Mode(Auto);temp = 0xff;
Serial.println(F("ACK CMD Set to Auto END"));break;
case 0x41:
myCAM.OV2640_set_Light_Mode(Sunny);temp = 0xff;
Serial.println(F("ACK CMD Set to Sunny END"));break;
case 0x42:
myCAM.OV2640_set_Light_Mode(Cloudy);temp = 0xff;
Serial.println(F("ACK CMD Set to Cloudy END"));break;
case 0x43:
myCAM.OV2640_set_Light_Mode(Office);temp = 0xff;
Serial.println(F("ACK CMD Set to Office END"));break;
case 0x44:
myCAM.OV2640_set_Light_Mode(Home); temp = 0xff;
Serial.println(F("ACK CMD Set to Home END"));break;
case 0x50:
myCAM.OV2640_set_Color_Saturation(Saturation2); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+2 END"));break;
case 0x51:
myCAM.OV2640_set_Color_Saturation(Saturation1); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+1 END"));break;
case 0x52:
myCAM.OV2640_set_Color_Saturation(Saturation0); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+0 END"));break;
case 0x53:
myCAM. OV2640_set_Color_Saturation(Saturation_1); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation-1 END"));break;
case 0x54:
myCAM.OV2640_set_Color_Saturation(Saturation_2); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation-2 END"));break;
case 0x60:
myCAM.OV2640_set_Brightness(Brightness2); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+2 END"));break;
case 0x61:
myCAM.OV2640_set_Brightness(Brightness1); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+1 END"));break;
case 0x62:
myCAM.OV2640_set_Brightness(Brightness0); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+0 END"));break;
case 0x63:
myCAM. OV2640_set_Brightness(Brightness_1); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness-1 END"));break;
case 0x64:
myCAM.OV2640_set_Brightness(Brightness_2); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness-2 END"));break;
case 0x70:
myCAM.OV2640_set_Contrast(Contrast2);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+2 END"));break;
case 0x71:
myCAM.OV2640_set_Contrast(Contrast1);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+1 END"));break;
case 0x72:
myCAM.OV2640_set_Contrast(Contrast0);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+0 END"));break;
case 0x73:
myCAM.OV2640_set_Contrast(Contrast_1);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast-1 END"));break;
case 0x74:
myCAM.OV2640_set_Contrast(Contrast_2);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast-2 END"));break;
case 0x80:
myCAM.OV2640_set_Special_effects(Antique);temp = 0xff;
Serial.println(F("ACK CMD Set to Antique END"));break;
case 0x81:
myCAM.OV2640_set_Special_effects(Bluish);temp = 0xff;
Serial.println(F("ACK CMD Set to Bluish END"));break;
case 0x82:
myCAM.OV2640_set_Special_effects(Greenish);temp = 0xff;
Serial.println(F("ACK CMD Set to Greenish END"));break;
case 0x83:
myCAM.OV2640_set_Special_effects(Reddish);temp = 0xff;
Serial.println(F("ACK CMD Set to Reddish END"));break;
case 0x84:
myCAM.OV2640_set_Special_effects(BW);temp = 0xff;
Serial.println(F("ACK CMD Set to BW END"));break;
case 0x85:
myCAM.OV2640_set_Special_effects(Negative);temp = 0xff;
Serial.println(F("ACK CMD Set to Negative END"));break;
case 0x86:
myCAM.OV2640_set_Special_effects(BWnegative);temp = 0xff;
Serial.println(F("ACK CMD Set to BWnegative END"));break;
case 0x87:
myCAM.OV2640_set_Special_effects(Normal);temp = 0xff;
Serial.println(F("ACK CMD Set to Normal END"));break;
}
if (start_capture == 2)
{
myCAM.flush_fifo();
myCAM.clear_fifo_flag();
//Start capture
myCAM.start_capture();
start_capture = 0;
}
if (myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK))
{
uint32_t length = 0;
length = myCAM.read_fifo_length();
if ((length >= MAX_FIFO_SIZE) | (length == 0))
{
myCAM.clear_fifo_flag();
start_capture = 2;
continue;
}
myCAM.CS_LOW();
myCAM.set_fifo_burst();//Set fifo burst mode
temp = SPI.transfer(0x00);
length --;
while ( length-- )
{
temp_last = temp;
temp = SPI.transfer(0x00);
if (is_header == true)
{
Serial.write(temp);
}
else if ((temp == 0xD8) & (temp_last == 0xFF))
{
is_header = true;
Serial.println(F("ACK IMG END"));
Serial.println(temp_last);
Serial.println(temp);
}
if ( (temp == 0xD9) && (temp_last == 0xFF) ) //If find the end ,break while,
break;
delayMicroseconds(15);
}
myCAM.CS_HIGH();
myCAM.clear_fifo_flag();
start_capture = 2;
is_header = false;
}
}
}
else if (mode == 3)
{
if (start_capture == 3)
{
//Flush the FIFO
myCAM.flush_fifo();
myCAM.clear_fifo_flag();
//Start capture
myCAM.start_capture();
start_capture = 0;
}
if (myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK))
{
Serial.println(F("ACK CMD CAM Capture Done. END"));delay(50);
uint8_t temp, temp_last;
uint32_t length = 0;
length = myCAM.read_fifo_length();
if (length >= MAX_FIFO_SIZE )
{
Serial.println(F("ACK CMD Over size. END"));
myCAM.clear_fifo_flag();
return;
}
if (length == 0 ) //0 kb
{
Serial.println(F("ACK CMD Size is 0. END"));
myCAM.clear_fifo_flag();
return;
}
myCAM.CS_LOW();
myCAM.set_fifo_burst();//Set fifo burst mode
Serial.write(0xFF);
Serial.write(0xAA);
for (temp = 0; temp < BMPIMAGEOFFSET; temp++)
{
Serial.write(pgm_read_byte(&bmp_header[temp]));
}
//for old version, enable it else disable
// SPI.transfer(0x00); char VH, VL; int i = 0, j = 0; for (i = 0; i < 240; i++) { for (j = 0; j < 320; j++) { VH = SPI.transfer(0x00);; VL = SPI.transfer(0x00);; Serial.write(VL); delayMicroseconds(12); Serial.write(VH); delayMicroseconds(12); } } Serial.write(0xBB); Serial.write(0xCC); myCAM.CS_HIGH(); //Clear the capture done flag myCAM.clear_fifo_flag(); } } }
uint8_t read_fifo_burst(ArduCAM myCAM) { uint8_t temp = 0, temp_last = 0; uint32_t length = 0; length = myCAM.read_fifo_length(); Serial.println(length, DEC); if (length >= MAX_FIFO_SIZE) //512 kb { Serial.println(F("ACK CMD Over size. END")); return 0; } if (length == 0 ) //0 kb { Serial.println(F("ACK CMD Size is 0. END")); return 0; } myCAM.CS_LOW(); myCAM.read_fifo();//Set fifo burst mode temp = SPI.transfer(0x00); length --; while ( length-- ) { temp_last = temp; temp = SPI.transfer(0x00); if (is_header == true) { Serial.println(temp); delay(500); LoRa.println(temp); delay(500); } else if ((temp == 0xD8) & (temp_last == 0xFF)) { is_header = true; Serial.println(F("ACK IMG END")); LoRa.println(F("ACK IMG END")); Serial.write(temp_last); LoRa.write(temp_last);
}
if ( (temp == 0xD9) && (temp_last == 0xFF) ) //If find the end ,break while,
break;
delayMicroseconds(15);
} myCAM.CS_HIGH(); is_header = false; return 1; }
Hi, I recommend that you run the demo with Arduino and camera to make sure there are no problems with the camera.Then print the data to you want to send in your code to the serial port, make sure the data is correct, and finally replace the print function with the function sent to another device.
I checked whether camera works normally or not. Camera works just fine. Image data is held in temp, isnt it? So i have to print temp in demo?
—
You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ArduCAM/Arduino/issues/479#issuecomment-607560195, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKHBGZHX5SKT7VHIASTXSTRKPOPDANCNFSM4LZMFMAA .
Hello,
temp = SPI.transfer(0x00);
This temp is the image data read from FIFO. 0XFF and 0XD8 is the head of JPEG image. 0XFF and 0XD9 is tail of JPEG image.Print the data between 0XFF,0XD8 and 0XFF, 0XD9. Make sure the image data is right.
As your recommend I am trying to write the image data to serial monitor only. In demo code read_fifo_burst function is given like that. ArduCAM App doesnt show values of temp or temp_last. This is why I am using Arduino's Serial Monitor. And in that serial monitor, I cant see any data unless I changed serial.write(temp) to serial.print(temp).
uint8_t read_fifo_burst(ArduCAM myCAM) { uint8_t temp = 0, temp_last = 0; uint32_t length = 0; length = myCAM.read_fifo_length(); Serial.println(length, DEC); if (length >= MAX_FIFO_SIZE) //512 kb { Serial.println(F("ACK CMD Over size. END")); return 0; } if (length == 0 ) //0 kb { Serial.println(F("ACK CMD Size is 0. END")); return 0; } myCAM.CS_LOW(); myCAM.set_fifo_burst();//Set fifo burst mode temp = SPI.transfer(0x00); length --; while ( length-- ) { temp_last = temp; temp = SPI.transfer(0x00); if (is_header == true) { Serial.write(temp); } else if ((temp == 0xD8) & (temp_last == 0xFF)) { is_header = true; Serial.println(F("ACK IMG END")); Serial.write(temp_last); Serial.write(temp); } if ( (temp == 0xD9) && (temp_last == 0xFF) ) //If find the end ,break while, break; delayMicroseconds(15); } myCAM.CS_HIGH(); is_header = false; return 1; }
[image: image.png] This is the output of example code ArduCAM_Mini_2MP_OV2640_functions. Should I use your app?If so, what should I do to see value of temp?
Arducam Support notifications@github.com, 2 Nis 2020 Per, 16:53 tarihinde şunu yazdı:
Hello, temp = SPI.transfer(0x00); This temp is the image data read from FIFO. 0XFF and 0XD8 is the head of JPEG image. 0XFF and 0XD9 is tail of JPEG image.Print the data between 0XFF,0XD8 and 0XFF, 0XD9. Make sure the image data is right.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ArduCAM/Arduino/issues/479#issuecomment-607860934, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKHBG5G6BWEX5ZFG245T7DRKSKHFANCNFSM4LZMFMAA .
Hello,
We asked you to print the values between 0XFF 0XD8 and X0FF 0XD9 to make sure the image data is correct. The printe function you can just use Serial.println
directly, and the data will be output to the Arduino‘s Serial port monitor.If there is noting wrong with the hardware that the image data will be right.You can use this demo that can be displayed by host app.App can be download here. Make sure the baud rate of the software is the same as set in the code.
If still not up to your requirements, please send your complete operation video and code through the file way to our mailbox.
I sent you the video of what I am doing. As you can see, in the first part, it takes a picture without a problem. In both 320x240 and 1600x1200 resolutions, camera took an image as it supposed to be. In 00.52, I opened the Serial monitor of Arduino and sent 0x10. It is for a single shoot and I want to use my camera in this format. Output was not meaningful for a human. I tried to print output with Serial.print and nothing was changed so I left as Serial.write. Then in 01.57 I opened another code.This code is essentially same with ArduCAM_Mini_2MP_OV2640_functions but I thought when Arduino reads the data from SPI, a problem occurs because of the baudrate of the Serial communication with PC. Hence I declared an array before the while loop named as TheArray. I sent all the image data read from SPI to this array and when this loop finishes, another loop begins. So i am printing the image data in this loop. But the output as blended as in the first part. Only part I changed is read_fifo_burst in ArduCAM_Mini_2MP_OV2640_functions, so i put here, only this function. What am I missing. You said if there was no mistake in the hardware, I have to see image data without problem in serial monitor of arduino. So what am i missing? uint8_t read_fifo_burst(ArduCAM myCAM) { uint8_t temp = 0, temp_last = 0; uint32_t length = 0; uint32_t length2 = 0; length = myCAM.read_fifo_length(); Serial.println(length, DEC); if (length >= MAX_FIFO_SIZE) //512 kb { Serial.println(F("ACK CMD Over size. END")); return 0; } if (length == 0 ) //0 kb { Serial.println(F("ACK CMD Size is 0. END")); return 0; } myCAM.CS_LOW(); myCAM.set_fifo_burst();//Set fifo burst mode temp = SPI.transfer(0x00); length --; length2 = length; Serial.begin(921600); uint8_t TheArray[length]; while ( length-- ) { temp_last = temp; temp = SPI.transfer(0x00); if (is_header == true) { //Serial.print(temp,HEX); //Serial.println();
}
else if ((temp == 0xD8) & (temp_last == 0xFF))
{
is_header = true;
/*Serial.println(F("ACK CMD IMG2 END"));
Serial.print("temp_last = ");
Serial.print(temp_last,HEX);
Serial.print(" temp = ");
Serial.print(temp,HEX);
Serial.println();*/
TheArray[length] = temp;
}
if ( (temp == 0xD9) && (temp_last == 0xFF) ) //If find the end ,break
while, break; delayMicroseconds(15); } Serial.println(F("ACK CMD IMG1 END")); myCAM.CS_HIGH(); uint32_t i; for (i=0; i<= length; i++) { Serial.println(); Serial.println(TheArray[i],HEX); } is_header = false; return 1; }
Ab ylmz adnanberatyilmaz@gmail.com, 8 Nis 2020 Çar, 17:54 tarihinde şunu yazdı:
Arducam Support notifications@github.com, 4 Nis 2020 Cmt, 18:09 tarihinde şunu yazdı:
Hello, We asked you to print the values between 0XFF 0XD8 and X0FF 0XD9 to make sure the image data is correct. The printe function you can just use Serial.println directly, and the data will be output to the Arduino‘s Serial port monitor.If there is noting wrong with the hardware that the image data will be right.You can use this demo https://github.com/ArduCAM/Arduino/tree/master/ArduCAM/examples/mini/ArduCAM_Mini_2MP_OV2640_functions that can be displayed by host app.App's download address https://github.com/ArduCAM/Arduino/blob/master/ArduCAM/examples/host_app/ArduCAM_Host_V2.0_Windows/ArduCAM_Host_V2.exe Make sure the baud rate of the software is the same as set in the code. If still not up to your requirements, please send your complete operation video and code through the file way to our mailbox.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ArduCAM/Arduino/issues/479#issuecomment-609042632, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKHBG2J4SQIBQWMXE5MXH3RK5ESPANCNFSM4LZMFMAA .
Thank you very much for the detailed video.
Firstly, explain why the output to the Serial monitor using Serial.print()
was not
meaningful for a human.Serial.print()
is print data to the Serial port as human-reading ASCII text, and Serial.write()
is write binary data to the Serial port.The serial port monitor that comes with Arduino displays the ASCII code directly. You can use a separate serial port tool to see the output data.Serial.println() is generally used to output temp values that are normally displayed in the Arduino Serial port, but there are minor problems with this program that cause Serial.println() to fail.
Comment out:
if (Serial. available())
{
...
}
and then
mode = 1
start_capture =1;
You can verify this problem. We will optimize this problem in later versions. You define an array and then output, which is not a good idea, because the image data is so large that it exceeds the Arduino ram, and the program has an exception.
has anyone tried ? is it working?
Hi, I am trying to send image data with LoRa module from one Arduino to other. SPI interface of both of them is OK. I edited ArduCAM_Mini_2MP_OV2640_functions to send the image datas. As far as I understand temp helds the image datas. So I am sending temp variable in the read_fifo_burst to other Arduino. When I printed the temp I see last of meaningless data in sender's serial monitor and see nothing in the receiver's terminal. I changed Serial.println(temp) to Serial.write(temp) but there was nothing changed or I could not noticed. The output was meaningless as well. I would appreciate if you could help me