Hi, I built the Light and Temperature logger project, to see if the shield / sd card were suitable for a project I'm planning. I also copied the sensor test sketch that goes with it. The circuit works fine and I get the results on the serial monitor, but alas nothing on the sd card. The card formats ok and works with the cardinfo sketch. Any thoughts?
Cheers
yellow12
Light and Temperature Loggers fails to write to SD card
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 3
- Joined: Tue Apr 01, 2014 8:46 am
- adafruit_support_bill
- Posts: 88086
- Joined: Sat Feb 07, 2009 10:11 am
Re: Light and Temperature Loggers fails to write to SD card
Do you get any error messages on the serial monitor when it tries to open the file?
-
- Posts: 3
- Joined: Tue Apr 01, 2014 8:46 am
Re: Light and Temperature Loggers fails to write to SD card
No, serial monitor works fine, just nothing writes to sd card, which I've just tested using read write sketchadafruit_support_bill wrote:Do you get any error messages on the serial monitor when it tries to open the file?
- adafruit_support_bill
- Posts: 88086
- Joined: Sat Feb 07, 2009 10:11 am
Re: Light and Temperature Loggers fails to write to SD card
Are you closing the file when you are done with it?
-
- Posts: 3
- Joined: Tue Apr 01, 2014 8:46 am
Re: Light and Temperature Loggers fails to write to SD card
I am just unplugging the usb cable. I don't see a' write to file' to sd card in sketch.adafruit_support_bill wrote:Are you closing the file when you are done with it?
- adafruit_support_bill
- Posts: 88086
- Joined: Sat Feb 07, 2009 10:11 am
Re: Light and Temperature Loggers fails to write to SD card
Unless you close the file or call "flush()" on it, the SD library will not write to the card until the block buffer fills up. This is by design (to reduce write cycles to the Flash memory on the SD card). But if you check the file before the first buffer is written, it will appear empty.
http://arduino.cc/en/Reference/SD
http://arduino.cc/en/Reference/SD
Please be positive and constructive with your questions and comments.