I want to show a bmp image from SD card to ssd1331 old 96".
I use this example Adafruit ImageReader/examples/Breakout SSD1331/Breakout SSD1331. ino
During upload sketch this error happened
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual void Adafruit_FlashTransport_SPI::begin()':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:39:16: error: 'OUTPUT' was not declared in this scope
pinMode(_ss, OUTPUT);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:39:22: error: 'pinMode' was not declared in this scope
pinMode(_ss, OUTPUT);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:40:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:40:25: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, HIGH);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual void Adafruit_FlashTransport_SPI::setClockSpeed(uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:46:36: error: 'MSBFIRST' was not declared in this scope
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::runCommand(uint8_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:50:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:50:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:56:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::readCommand(uint8_t, uint8_t*, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:63:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:63:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:72:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::writeCommand(uint8_t, const uint8_t*, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:80:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:80:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:89:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::eraseCommand(uint8_t, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:96:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:96:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:107:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::readMemory(uint32_t, uint8_t*, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:114:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:114:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:129:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::writeMemory(uint32_t, const uint8_t*, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:137:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:137:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
^
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:152:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
^
exit status 1
Error compiling for board DOIT ESP32 DEVKIT V1.
//Change the code below by your sketch
// Adafruit_ImageReader test for Adafruit ST7735 TFT Breakout for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// rgbwheel.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Arduino.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_SSD1331.h> // Hardware-specific library
#include <SdFat.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define TFT_CS 15 // TFT select pin
#define TFT_RST 22 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC 12 // TFT display/command pin
#define SD_CS 5 // SD card select pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatFileSystem filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_SSD1331 tft = Adafruit_SSD1331(&SPI, TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup() {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(115200);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
tft.begin(); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatFileSystem object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(BLUE);
// Load full-screen BMP file 'daffodil.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading daffodil.bmp to screen..."));
stat = reader.drawBMP("/daffodil.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}
Debug Messages:
Enable Core debug level: Debug on tools menu of Arduino IDE, then put the serial output here
Hardware:
Board: ?ESP32 DevkitV1 Core Installation/update date: ?1.0.4 IDE name: ?Arduino IDE 1.8.12 Flash Frequency: ?80Mhz? PSRAM enabled: ?no Upload Speed: ?921600 Computer OS: ?Windows 10
Description:
I want to show a bmp image from SD card to ssd1331 old 96". I use this example Adafruit ImageReader/examples/Breakout SSD1331/Breakout SSD1331. ino During upload sketch this error happened
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual void Adafruit_FlashTransport_SPI::begin()':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:39:16: error: 'OUTPUT' was not declared in this scope
pinMode(_ss, OUTPUT);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:39:22: error: 'pinMode' was not declared in this scope
pinMode(_ss, OUTPUT);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:40:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:40:25: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, HIGH);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual void Adafruit_FlashTransport_SPI::setClockSpeed(uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:46:36: error: 'MSBFIRST' was not declared in this scope
_setting = SPISettings(clock_hz, MSBFIRST, SPI_MODE0);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::runCommand(uint8_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:50:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:50:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:56:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::readCommand(uint8_t, uint8_t*, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:63:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:63:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:72:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::writeCommand(uint8_t, const uint8_t*, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:80:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:80:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:89:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::eraseCommand(uint8_t, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:96:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:96:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:107:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::readMemory(uint32_t, uint8_t*, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:114:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:114:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:129:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp: In member function 'virtual bool Adafruit_FlashTransport_SPI::writeMemory(uint32_t, const uint8_t*, uint32_t)':
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:137:21: error: 'LOW' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:137:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_ss, LOW);
Arduino\libraries\Adafruit_SPIFlash\src\spi\Adafruit_FlashTransport_SPI.cpp:152:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ss, HIGH);
exit status 1 Error compiling for board DOIT ESP32 DEVKIT V1.
Please guide me I asked github adafruit and they say: Something is wrong with your library installation or IDE setup - please post in the DOIT or esp32 forums for help! https://github.com/adafruit/Adafruit_ImageReader/issues/29
Sketch: (leave the backquotes for code formatting)
Debug Messages: