From 96b925737c8e9c20a1bbcd12d46fc5c8f03d7f99 Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Mon, 8 Nov 2021 13:28:11 +0100 Subject: [PATCH] 1.5.1 I2C_EEPROM cleanup --- .../examples/I2C_eeprom_test/new 2.txt | 128 ------------------ 1 file changed, 128 deletions(-) delete mode 100644 libraries/I2C_EEPROM/examples/I2C_eeprom_test/new 2.txt diff --git a/libraries/I2C_EEPROM/examples/I2C_eeprom_test/new 2.txt b/libraries/I2C_EEPROM/examples/I2C_eeprom_test/new 2.txt deleted file mode 100644 index 3e580895..00000000 --- a/libraries/I2C_EEPROM/examples/I2C_eeprom_test/new 2.txt +++ /dev/null @@ -1,128 +0,0 @@ - -Try this (not tested) -[code] -//#include -#include -#include -#include -#include - -#define SD_CS 9 - - -//UTFT(byte model, int RS, int WR, int RD, int CS) -//UTFT myGLCD(ITDB32S,A2,A1,A0,10); // Remember to change the model parameter to suit your display module! -//ArduCAM(byte model,int RS, int WR, int RD, int REG_CS, int FIFO_CS) -ArduCAM myCAM(OV2640,A2,A1,A0,A3,10); // Remember to change the model parameter to suit your canera module! - -void setup() -{ - Serial.begin(115200); // <<<<<<<<<<<<<<<<<<<<<<< - Serial.println("Start arducam test"); - - //Initialize I2C Bus - Wire.begin(); - //Switch to FIFO Mode - myCAM.write_reg(ARDUCHIP_TIM, MODE_MASK); - //Set sensor to JPEG mode. Note don't all the camera modules support JPEG mode - myCAM.OV2640_set_format(JPEG); - //Initialize Camera Module - myCAM.InitCAM(); - myCAM.OV2640_set_JPEG_size(OV2640_320x240); - - Serial.println("SD.begin"); - //Initialize SD Card - if (!SD.begin(SD_CS)) - { - Serial.println("SD card failed"); - //while (1); //If failed, stop here - } - Serial.println("SD card success"); - Serial.println("End setup"); -} - -void loop() -{ - Serial.print(millis()); - Serial.println("\tstart loop"); - - char str[8]; - File outFile; - static int k = 0; - uint8_t temp,temp_last; - uint8_t start_capture = 0; - - Serial.print(millis()); - Serial.println("\tWait trigger from shutter buttom"); - - //Wait trigger from shutter buttom - if(myCAM.read_reg(ARDUCHIP_TRIG) & SHUTTER_MASK) - { - //Wait until buttom released - while(myCAM.read_reg(ARDUCHIP_TRIG) & SHUTTER_MASK); - start_capture = 1; - } - - - Serial.print(millis()); - Serial.println("\tStart capture I"); - //Start capture when detect a valid shutter press - if(start_capture) - { - //Flush the FIFO - myCAM.flush_fifo(); - //Start capture - myCAM.start_capture(); - } - - if(myCAM.read_reg(ARDUCHIP_TRIG) & CAP_DONE_MASK) - { - //Construct a file name - k = k + 1; - itoa(k, str, 10); - strcat(str,".jpg"); - //Open the new file - outFile = SD.open(str,FILE_WRITE); - if (! outFile) - { - Serial.print(millis()); - Serial.println("\tfailure outfile"); - return; - } - - Serial.print(millis()); - Serial.println("\toutfile succes"); - - //Enable FIFO - myCAM.enable_fifo(); - - uint32_t bytecounter = 0; - //Read the first dummy byte from FIFO - temp = myCAM.read_fifo(); - - //Read JPEG data from FIFO - while( (temp != 0xD9) | (temp_last != 0xFF) ) - { - bytecounter++; - if (bytecounter % 32 == 0) Serial.print('.'); - if (bytecounter % 1024 == 0) Serial.println; - temp_last = temp; - temp = myCAM.read_fifo(); - //Write image data to file - outFile.write(temp); - } - Serial.println(); - - //Disable FIFO when all the image data is saved to the file - myCAM.disable_fifo(); - //Close the file - outFile.close(); - - //Clear the capture done flag - myCAM.clear_fifo_flag(); - //Clear the start capture flag - start_capture = 0; - } -} - -[/code] \ No newline at end of file