I use a WeMos D1 board and it's working fine.
I want to use an SD card but I get a mismatch by:
Sd2Card card;
SdVolume volume;
SdFile root;
First I thought there must filled in some parameters but after searching on Internet and the forum I think there's another problem. Who can help me.?
I know I can find a lot in the library SD.h, but I don't know where I can find it.
Greetings Ptr
Niet gebruikt: C:\Program Files\Arduino\libraries\SD
Bibliotheek SPI op versie 1.0 in map: C:\Users\Peter\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\SPI wordt gebruikt
Bibliotheek SD op versie 2.0.0 in map: C:\Users\Peter\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\SD wordt gebruikt
Bibliotheek SDFS op versie 0.1.0 in map: C:\Users\Peter\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\SDFS wordt gebruikt
Bibliotheek ESP8266SdFat op versie 2.0.2 in map: C:\Users\Peter\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266SdFat wordt gebruikt
This example shows how use the utility libraries on which the'
SD library is based in order to get info about your SD card.
Very useful for testing a card when you're not sure whether its working or not.
The circuit:
SD card attached to SPI bus as follows:
** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
** CS - depends on your SD card shield or module.
Pin 4 used here for consistency with other Arduino examples
created 28 Mar 2011
by Limor Fried
modified 9 Apr 2012
by Tom Igoe
*/
// include the SD library: #include <SPI.h> #include <SD.h>
// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;
// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
const int chipSelect = D2; #define _cs D2
void setup()
{
pinMode(_cs, OUTPUT);
digitalWrite(_cs, HIGH);
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
</>
After searching the Internet for " Sd2Card does not name a type" I believe the problem may be occurring because you are using an ESP8266 rather than an Arduino with an AVR processor
As an experiment try changing the board to a Uno and verifying the sketch
Hai UKHeliBob
When I started this question on the forum I was afraid the conclusion was: use an Uno.
I always use the ESP8266 and you always read: compatible with Uno.
But I don't believe it anymore. I'll buy an Uno and try the same sketch.
But it's also possible there are problems because the SD library is changed and that's the reason the example is removed in the IDE. In the SD example 'Read and Write' there is no line with 'Sd2Card card'. I will let you know if it works with the UNO.
Greetings and thanks for your help.
Ptrzet
I successfully integrated an SD card with ESP32 based on the libraries and code mentioned in the link given above. I don't think Uno is efficient in handling the SD card since data in sd card mainly deals with String and string manipulation involves a huge chunk of memory for which controllers are not built.
That is not because of the SD card or the SD library. Neither the card nor the library uses the String class. That is a programmer's choice. If that screws things up, it's because the programmer made the choice to use the String class, not because of any feature or aspect of the SD library.
The limitation with the Uno is simpler - it's that the I/O buffer has to reside in RAM. So it uses up a fair portion of the Uno's limited complement of RAM. IIRC, the buffer is 512 bytes.