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 - วิทยาศาสตร์และเทคโนโลยี
// 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
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?
esp32 can't really work with google api, but it works fine with google apps script, so you should start with it
thanks!
That is great but where i put the username and password of google drive, where can I find the complet code ? Thank you
What do we need to do for Gmail?
you want to send images to some email?
@@anyboards8006 yes.