ESP32-CAM: Uploading images to Google Drive

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ม.ค. 2020
  • Espressif ESP32 cam board ali.pub/4dkuzp
    Google app script doesn't offer the file upload, you have to convert a file to base64
    //Google app script
    function doPost(e) {
    var decoded = Utilities.base64Decode(e.postData.contents);
    var date=new Date();
    var blob = Utilities.newBlob(decoded, "image/jpeg", 'img_'+date+'.jpg');
    var f=DriveApp.createFile(blob);
    return ContentService.createTextOutput(f.getId());
    }
    //Google app script end
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 7

  • @anyboards8006
    @anyboards8006  4 ปีที่แล้ว +2

    // ESP32 Code
    #include "mbedtls/base64.h"
    //...
    camera_fb_t* fb =esp_camera_fb_get();
    size_t olen;
    unsigned char* base64;
    mbedtls_base64_encode(base64, 0, &olen, fb->buf, fb->len);
    base64 = (unsigned char*)malloc(olen);
    mbedtls_base64_encode(base64, olen, &olen, fb->buf, fb->len);
    esp_camera_fb_return(fb);
    //... send data
    free(base64);
    // ESP32 Code end

  • @balint603
    @balint603 3 ปีที่แล้ว

    Hi,
    I would like to upload logfiles to drive from an ESP32 but I don't really understand the Google API.
    Could you help me, where should I begin to learn?

    • @anyboards8006
      @anyboards8006  3 ปีที่แล้ว

      esp32 can't really work with google api, but it works fine with google apps script, so you should start with it
      thanks!

  • @diegobernal334
    @diegobernal334 3 ปีที่แล้ว

    That is great but where i put the username and password of google drive, where can I find the complet code ? Thank you

  • @ilkeraykut7064
    @ilkeraykut7064 3 ปีที่แล้ว

    What do we need to do for Gmail?

    • @anyboards8006
      @anyboards8006  3 ปีที่แล้ว +1

      you want to send images to some email?

    • @ilkeraykut7064
      @ilkeraykut7064 3 ปีที่แล้ว

      @@anyboards8006 yes.