Re: ESP32 CAM Foto uložené v bufferu
Napsal: 15 črc 2021, 11:56
No jestli se nepletu ten modul SIM800 by měl reagovat jen na AT povely a jiné data by měl ignorovat.
České fórum pro všechny nadšence do Arduina a dalších technologií.
https://forum.hwkitchen.cz/
Pro jakýkoliv SIMxxx je výhodné si vyrobit funkci, kterou zavoláme s parametry:
Kód: Vybrat vše
void takePhoto() {
camera_fb_t * fb = NULL;
// Take Picture with Camera
fb = esp_camera_fb_get();
Serial.print("Velikost obrazu: ");
Serial.print(fb->len);
Serial.print(" B,");
Serial.print((fb->len)/1024);
Serial.println(" KB");
if(!fb) {
Serial.println("Camera capture failed");
To bych taky uvítal ale nevím? jak mě se třeba stane že někdy to je OK a někdy chybou a ten příkaz který skončí chybou tak ho opakovat ? další věc já laboruji jen s textem ale s té kamery jdou data v hex formátu
Kód: Vybrat vše
20:03:30.832 -> OK
20:03:33.794 -> AT+FTPPUT=1
20:03:33.841 -> OK
20:03:33.841 ->
20:03:33.841 -> +FTPPUT: 1,1,1360
20:03:36.804 -> AT+FTPPUT=2,1024
20:03:36.851 -> +FTPPUT: 2,1024
Kód: Vybrat vše
camera_fb_t fb;
Kód: Vybrat vše
fb=esp_camera_fb_get();
Kód: Vybrat vše
Serial.write(fb.buf, fb.len)
Kód: Vybrat vše
#include "esp_camera.h"
// Pin definition for CAMERA_MODEL_AI_THINKER
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
camera_config_t config;
void setup() {
camera_fb_t * fb = NULL;
fb = esp_camera_fb_get();
Serial.begin(9600);
initCamera();
takePhoto();
ATInternet();
}
void loop() {
//takePhoto();
//delay(10000);
//}
}
void initCamera() {
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
if(psramFound()){
config.frame_size = FRAMESIZE_XGA;//FRAMESIZE_UXGA; // FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA
config.jpeg_quality = 10;
config.fb_count = 2;
} else {
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}
// Init Camera
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
return;
}
}
void takePhoto() {
byte dat=0;
camera_fb_t * fb = NULL;
// Take Picture with Camera
fb = esp_camera_fb_get();
Serial.print("Velikost obrazu: ");
Serial.print(fb->len);
Serial.print(" B,");
Serial.print((fb->len)/1024);
Serial.println(" KB");
//Serial.print("0x");
/*for(int i=0;i<fb->len;i++)
Serial.print(fb->buf[i], HEX);*/
Serial.println("");
// dat = HEX(fb->buf);
//Serial.write(fb->buf,fb->len);
if(!fb) {
Serial.println("Camera capture failed");
while(fb->len){
// dat=fb->buf,fb->len;
//Serial.print(fb->buf,fb->len);
}
return;
}
/*
* Free buffer cam
*/
esp_camera_fb_return(fb);
}
void ATInternet(){
String mesage="";
delay(10000);
Serial.print("AT+SAPBR=3,1,\"Contype\",\"GPRS\"\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+SAPBR=3,1,\"APN\",\"internet\"\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+SAPBR=1,1\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+SAPBR=2,1\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+FTPCID=1\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+FTPSERV=\"**********\"\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+FTPUN=\********\"\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+FTPPW=\*******\"\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+FTPPUTPATH=\"/**********/\"\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+FTPPUTNAME=\"********\"\r");
Serial.flush();
delay(1000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+FTPPUT=1\r");
Serial.flush();
delay(3000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
Serial.print("AT+FTPPUT=2,1024\r");
Serial.flush();
delay(3000);
while(Serial.available()){
mesage=mesage+Serial.read();
}
for(int i=0;1024;i++)
Serial.write(fb->buf[i]); //**'fb' was not declared in this scope** chyba!!
// put your setup code here, to run once:
delay(3000);
Serial.print("AT+FTPPUT=2,0\r");
Serial.flush();
}
Kód: Vybrat vše
Serial.print( " Web Web, na kterém se uživatel bez registrace - IP adresa, cookies, datum a čas návštěvy, stránky na webu navštívené, identifikace zařízení, typ prohlížeče, jeho verze a nastavení, rozlišení obrazovky, operační systém V červnu roku 1963 ukázala Valentina Těreškovovová (84) celému světu, že žena je schopna stejně věhlasných činů jako muži, když během třídenní výpravy do kosmu osmačtyřicetkrát obletěla zeměkouli. Legendou zůstala dodnes, přestože už dávno vyšly najevo nelichotivé okolnosti jejího letu, který málem skončil tragédií.Po přelomové cestě Jurije Gagarina do vesmíru nebyl důvod pochybovat o tom, že by stejnou misi teoreticky zvládla i žena, pokud by k tomu byla náležitě vyškolena. Emancipace v poválečném světě nabrala na síle a Sovětský svaz uctíval řadu hrdinek, které se za války osvědčily jako neohrožené pilotky. Žena v kokpitu už zkrátka nebyla tabu. Sovětům ale nestačila teorie. O nezdolné síle a schopnostech svých žen chtěli podat živý důkaz. A navíc se jim líbila myšlenka, že by k prvnímu muži ve vesmíru historie připsala i první ženu - a opět se zkratkou SSSR v závorkách.");