So i have made a cod wich makes some files and should make me able via web to see the fiiles and download them.
But i have some problems. I understand that i need this line of code
if (!sd.begin(10, SPI_HALF_SPEED)) sd.initErrorHalt(); to bee able to make files and folders (it was someting other than 10 but i dont remember know what it was, howeer its the same)
but if i use this then i cand open files via webserver :S
I can open the ip 192.168.10.108 and it shows files and folders in root, but i cant open them, if i try it says that files not exists. When i delete the !sd.begine line, i can open the files but cannot create any :S why is that so, and how to fix it please?
here is the setup funciton
void setup() {
Serial.begin(9600);
PgmPrint("Free RAM: ");
Serial.println(FreeRam());
// initialize the SD card at SPI_HALF_SPEED to avoid bus errors with
// breadboards. use SPI_FULL_SPEED for better performance.
pinMode(10, OUTPUT); // set the SS pin as an output (necessary!)
digitalWrite(10, HIGH); // but turn off the W5100 chip!
pinMode(I1,INPUT);
pinMode(I2,INPUT);
pinMode(I3,INPUT);
pinMode(U1,INPUT);
pinMode(U2,INPUT);
pinMode(U3,INPUT);
setTime(23, 59 , 23 ,31, 10, 2013);
if (!sd.begin(10, SPI_HALF_SPEED)) sd.initErrorHalt();
if (!card.init(SPI_HALF_SPEED, 4)) error("card.init failed!");
// initialize a FAT volume
if (!volume.init(&card)) error("vol.init failed!");
PgmPrint("Volume is FAT");
Serial.println(volume.fatType(),DEC);
Serial.println();
if (!root.openRoot(&volume)) error("openRoot failed");
// list file in root with date and size
PgmPrintln("Files found in root:");
root.ls(LS_DATE | LS_SIZE);
Serial.println();
// Recursive list of all directories
PgmPrintln("Files found in all dirs:");
root.ls(LS_R);
Serial.println();
PgmPrintln("Done");
// Debugging complete, we start the server!
Ethernet.begin(mac, ip);
server.begin();