Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailem Modul SIM800 GPRS

Já se omlouvám tak tedy tady je příklad jak dostat pomocí FTP a domácí sítě obrázek na FTP server https://www.youtube.com/watch?v=8e4fjskXfoI&ab_channel=GuillermoSampallo a mě napadlo nebýt vázaný na domácí WiFi a použít pro přenos fotky mobilní internet

#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() {
   
  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((fb->len) % 1024);
  //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(){
  int poz=0;
  int dopocet=1024;
  camera_fb_t * fb = NULL;
  // Take Picture with Camera
  fb = esp_camera_fb_get(); 
  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=\"picture.jpg\"\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();
  }
  int c=(fb->len)/1024;
for(int l=0;l<=c;l++){

Serial.print("AT+FTPPUT=2,1024\r");

Serial.flush();
delay(3000);
 while(Serial.available()){
    mesage=mesage+Serial.read();
  }
  for(int i=0;i<=1024;i++)
     Serial.print(fb->buf[poz]);
     poz++;
  // put your setup code here, to run once:
delay(3000);
}
int z=(fb->len)%1024;
Serial.print("AT+FTPPUT=2,");
Serial.print(z);
Serial.print("\r");
Serial.flush();
 for(int i=0;i<=z;i++){
     Serial.print(fb->buf[poz]);
     poz++;
 }
Serial.print("AT+FTPPUT=2,0\r");
Serial.flush();
}

tady je výpis ze seriového monitoru i na FTP se mě povedlo něco přenést ale pár desitek KB ale něco je tam špatně nevím co ? díky

Reakce na odpověď

1 Zadajte svou přezdívku:
2 Napište svou odpověď:
3 Pokud chcete dostat ban, zadejte libovolný text:

Zpět do poradny