buenas, podrian ayudarme por favor, mi codigo esta funcionando, es un album de fotos pero tengo la limitante de 3mb por use 1MB APP/3MB SPIFFS, y quiero usar una sd para guardar las fotos.
Les comento que no estudie nada de programacion, solo tengo educacion primaria (mexico) pero soy un auto didacta empedernido, el codigo original que use es este Arduino_GFX/examples/ImgViewer/ImgViewerJpeg at master · moononournation/Arduino_GFX · GitHub ahorita puedo mostrar 13 imagenes, se cambian cada 15 segundos.
En el mismo codigo dice de unas librerias para sd las cuales ya tengo instaladas, pero no se como activar la lectura sd en el codigo ni como conectarla al sp32 (vi algunos tutoriales de como hacerlo pero no funcionan en mi codigo)
el codigo modificado por mi:
/*******************************************************************************
* JPEG Image Viewer
* This is a simple JPEG image viewer example
* Image Source: https://github.blog/2014-11-24-from-sticker-to-sculpture-the-making-of-the-octocat-figurine/
*
* Dependent libraries:
* JPEGDEC: https://github.com/bitbank2/JPEGDEC.git
*
* Setup steps:
* 1. Change your LCD parameters in Arduino_GFX setting
* 2. Upload JPEG file
* FFat (ESP32):
* upload FFat (FatFS) data with ESP32 Sketch Data Upload:
* ESP32: https://github.com/lorol/arduino-esp32fs-plugin
* LittleFS (ESP32 / ESP8266 / Pico):
* upload LittleFS data with ESP8266 LittleFS Data Upload:
* ESP32: https://github.com/lorol/arduino-esp32fs-plugin
* ESP8266: https://github.com/earlephilhower/arduino-esp8266littlefs-plugin
* Pico: https://github.com/earlephilhower/arduino-pico-littlefs-plugin.git
* SPIFFS (ESP32):
* upload SPIFFS data with ESP32 Sketch Data Upload:
* ESP32: https://github.com/lorol/arduino-esp32fs-plugin
* SD:
* Most Arduino system built-in support SD file system.
* Wio Terminal require extra dependant Libraries:
* - Seeed_Arduino_FS: https://github.com/Seeed-Studio/Seeed_Arduino_FS.git
* - Seeed_Arduino_SFUD: https://github.com/Seeed-Studio/Seeed_Arduino_SFUD.git
******************************************************************************/
#define GIF_FILENAME "/ezgif.com-resize.gif"
#define JPEG_FILENAME1 "/1.jpg"
#define JPEG_FILENAME2 "/2.jpg"
#define JPEG_FILENAME3 "/3.jpg"
#define JPEG_FILENAME4 "/4.jpg"
#define JPEG_FILENAME5 "/5.jpg"
#define JPEG_FILENAME6 "/6.jpg"
#define JPEG_FILENAME7 "/7.jpg"
#define JPEG_FILENAME8 "/8.jpg"
#define JPEG_FILENAME9 "/9.jpg"
#define JPEG_FILENAME10 "/10.jpg"
#define JPEG_FILENAME11 "/11.jpg"
#define JPEG_FILENAME12 "/12.jpg"
#define JPEG_FILENAME13 "/13.jpg"
/*******************************************************************************
* Start of Arduino_GFX setting
*
* Arduino_GFX try to find the settings depends on selected board in Arduino IDE
* Or you can define the display dev kit not in the board list
* Defalult pin list for non display dev kit:
* Arduino Nano, Micro and more: CS: 9, DC: 8, RST: 7, BL: 6
* ESP32 various dev board : CS: 5, DC: 27, RST: 33, BL: 22
* ESP32-C3 various dev board : CS: 7, DC: 2, RST: 1, BL: 3
* ESP32-S2 various dev board : CS: 34, DC: 35, RST: 33, BL: 21
* ESP32-S3 various dev board : CS: 40, DC: 41, RST: 42, BL: 48
* ESP8266 various dev board : CS: 15, DC: 4, RST: 2, BL: 5
* Raspberry Pi Pico dev board : CS: 17, DC: 27, RST: 26, BL: 28
* RTL8720 BW16 old patch core : CS: 18, DC: 17, RST: 2, BL: 23
* RTL8720_BW16 Official core : CS: 9, DC: 8, RST: 6, BL: 3
* RTL8722 dev board : CS: 18, DC: 17, RST: 22, BL: 23
* RTL8722_mini dev board : CS: 12, DC: 14, RST: 15, BL: 13
* Seeeduino XIAO dev board : CS: 3, DC: 2, RST: 1, BL: 0
* Teensy 4.1 dev board : CS: 39, DC: 41, RST: 40, BL: 22
******************************************************************************/
#include <Arduino_GFX_Library.h>
#define TFT_BL 23
/* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */
#if defined(DISPLAY_DEV_KIT)
Arduino_GFX *gfx = create_default_Arduino_GFX();
#else /* !defined(DISPLAY_DEV_KIT) */
/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
Arduino_DataBus *bus = new Arduino_ESP32SPI(19 /* DC */, 5 /* CS */, 22 /* SCK */, 21 /* MOSI */, 27 /* MISO */);
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
Arduino_GFX *gfx = new Arduino_ST7796(bus, 17 /* RST */, 0 /* rotation */);
#endif /* !defined(DISPLAY_DEV_KIT) */
/*******************************************************************************
* End of Arduino_GFX setting
******************************************************************************/
/* Wio Terminal */
#if defined(ARDUINO_ARCH_SAMD) && defined(SEEED_GROVE_UI_WIRELESS)
#include <Seeed_FS.h>
#include <SD/Seeed_SD.h>
#elif defined(ARDUINO_RASPBERRY_PI_PICO)
#include <LittleFS.h>
#include <SD.h>
#include <SPI.h>
#elif defined(ESP32)
#include <FFat.h>
#include <LittleFS.h>
#include <SPIFFS.h>
#include <SD.h>
#include <SPI.h>
#elif defined(ESP8266)
#include <LittleFS.h>
#include <SD.h>
#else
#include <SD.h>
#endif
#include "GifClass.h"
static GifClass gifClass;
#include "JpegFunc.h"
// pixel drawing callback
static int jpegDrawCallback(JPEGDRAW *pDraw)
{
// Serial.printf("Draw pos = %d,%d. size = %d x %d\n", pDraw->x, pDraw->y, pDraw->iWidth, pDraw->iHeight);
gfx->draw16bitBeRGBBitmap(pDraw->x, pDraw->y, pDraw->pPixels, pDraw->iWidth, pDraw->iHeight);
return 1;
}
void setup()
{
Serial.begin(115200);
// while (!Serial);
Serial.println("JPEG Image Viewer");
// Init Display
gfx->begin();
gfx->fillScreen(BLACK);
#ifdef GFX_BL
pinMode(GFX_BL, OUTPUT);
digitalWrite(GFX_BL, HIGH);
#endif
/* Wio Terminal */
#if defined(ARDUINO_ARCH_SAMD) && defined(SEEED_GROVE_UI_WIRELESS)
if (!SD.begin(SDCARD_SS_PIN, SDCARD_SPI, 4000000UL))
#elif defined(ARDUINO_RASPBERRY_PI_PICO)
// if (!LittleFS.begin())
if (!SD.begin(SS))
#elif defined(ESP32)
// if (!FFat.begin(true))
// if (!LittleFS.begin())
if (!SPIFFS.begin(true))
#elif defined(ESP8266)
if (!LittleFS.begin())
// if (!SD.begin(SS))
#else
if (!SD.begin())
#endif
{
Serial.println(F("ERROR: File System Mount Failed!"));
gfx->println(F("ERROR: File System Mount Failed!"));
}
delay(100);
}
void loop()
{
unsigned long start = millis();
jpegDraw(JPEG_FILENAME1, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME2, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME3, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME4, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME5, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME6, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME7, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME8, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME9, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME10, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME111, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME12, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
jpegDraw(JPEG_FILENAME13, jpegDrawCallback, true /* useBigEndian */,
0 /* x */, 0 /* y */, gfx->width() /* widthLimit */, gfx->height() /* heightLimit */);
Serial.printf("Time used: %lu\n", millis() - start);
delay(15000);
}
Uso un esp32 dev de 30 pines, pantalla 4# ST7796 la pantalla ya tiene sd integrado, aunque tengo otros 2 modulos. y uso el IDE de arduino.
ojal puedan ayudarme, gracias por leerme.