I am trying to encode image taken with ESP32-CAM to base64 encoded string so it can be posted to MQTT.
I have installed GitHub - Xander-Electronics/Base64: A Base64 library for Arduino library and have following code
#include "esp_camera.h"
#include "Arduino.h"
#include "soc/soc.h" // Disable brownour problems
#include "soc/rtc_cntl_reg.h" // Disable brownour problems
#include "driver/rtc_io.h"
#include <Base64.h>
#include <WiFi.h>
#include <PubSubClient.h>
....
camera_fb_t * fb = NULL;
// Take Picture with Camera
fb = esp_camera_fb_get();
if(!fb) {
Serial.println("Camera capture failed");
return;
}
else {
base64_encode(encoded_image, fb->buf, fb->len);
client.publish("esp32/data", encoded_image.c_str());
}
// initialize EEPROM with predefined size
// EEPROM.begin(EEPROM_SIZE);
esp_camera_fb_return(fb);
But I get following error while compiling
Alternatives for avr/pgmspace.h: []/home/root/Arduino/libraries/Base64/src/Base64.cpp:11:26: fatal error: avr/pgmspace.h: No such file or directory
compilation terminated.
ResolveLibrary(avr/pgmspace.h)
-> candidates: []
Multiple libraries were found for "Base64.h"
Used: /home/root/Arduino/libraries/Base64
Multiple libraries were found for "WiFi.h"
Used: /home/root/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
Not used: /opt/arduino-1.8.10/libraries/WiFi
Multiple libraries were found for "PubSubClient.h"
Used: /home/root/Arduino/libraries/PubSubClient
Using library Base64 at version 0.0.1 in folder: /home/root/Arduino/libraries/Base64
Using library WiFi at version 1.0 in folder: /home/root/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
Using library PubSubClient at version 2.7 in folder: /home/root/Arduino/libraries/PubSubClient
exit status 1
Error compiling for board ESP32 Wrover Module.
I have these libraries installed
root@xps-l521x:~$ ls /home/root/Arduino/libraries/
Adafruit_BME280_Library Arduino_JSON PubSubClient
Adafruit_BME680_Library AsyncTCP readme.txt
Adafruit_Circuit_Playground Base64
Adafruit_Unified_Sensor ESPAsyncWebServer
root@xps-l521x:~$
Whats wrong here ?