I'm using the ethernet shield and Uno. I'm reading data from a serial port then I go out to the Internet to get info and then write the respone from the NET to the SD card.
I have done this project in pieces and each piece works but I have a problem when I put it all together.
The first time through it works fine but it fails to connect to the SD card after that. I have to reboot.
I have a "client.flush" and "client.stop" at the end of reading data from the URL.
I use "file.begin(4)" and "SD.open" to open the file and then "file.close" when done.
Can I use them both as long as I stop one before starting the other?
The first time through it works fine but it fails to connect to the SD card after that. I have to reboot.
I have a "client.flush" and "client.stop" at the end of reading data from the URL.
I use "file.begin(4)" and "SD.open" to open the file and then "file.close" when done.
Can I use them both as long as I stop one before starting the other?
I use them both without diddling with the SS pins. When I did try to diddle with the SS pins, to ensure that only the correct device was active, it did not work.
Thanks Paul for the reply.
Can you give me an example of using ethernet and SD in the same sketch?
I can't get it to work. First iteration it goes out to a URL, reads the data and writes to the SD card.
After that the sd.begin(4) fails. Still reads the data from the URL.
the code change that fat16lib suggested is already in the cpp file.
On the first iteration it writes to to the SD card.
strcpy_P(prog_buffer, (char*)pgm_read_word(&(string_table[4]))); // UPC file.
upcFile = SD.open(prog_buffer, FILE_WRITE);
prog_buffer equals the file name and upcFile = 1.
After that prog_buffer still equals the file name but upcFile = 0.
I'm perplexed...
I could not upload the entire sketch because of the size but I think the problem is memory.
I did some cleanup, and it started working.
I still have more code to add so I will see what happens. I also have another post in programming.
Thanks for your comments.