tigrot Well-Known Member Licensed User Longtime User Feb 7, 2018 #1 Hi everybody, since there is no directory handling in rSD library, how can I create my directory tree? I have seen that sd library included in Arduino environment includes mkdir() and rmdir() and is referenced by rSD. Regards Mauro Zanin
Hi everybody, since there is no directory handling in rSD library, how can I create my directory tree? I have seen that sd library included in Arduino environment includes mkdir() and rmdir() and is referenced by rSD. Regards Mauro Zanin
Erel B4X founder Staff member Licensed User Longtime User Feb 7, 2018 #2 Please try the attached library. Make sure to copy it to the internal libraries folder. Attachments rSD.zip rSD.zip 21.3 KB · Views: 612 Upvote 0
tigrot Well-Known Member Licensed User Longtime User Feb 7, 2018 #3 Hi Erel, I updated the SD library in Arduino environment and substituted the rSD library. I can write and read files(in root) but mkdir seems not to work. This is my code: Code: Main.sd.MKDir("/logmetalim") Main.sd.MKDir("/logmetalim/segnala") I have read that the second mkdir could suffice, since the whole tree is created at once, differently from other enviromnents. I have also tried to call mkdir from inline code and got no result. But my code could be wrong... Upvote 0
Hi Erel, I updated the SD library in Arduino environment and substituted the rSD library. I can write and read files(in root) but mkdir seems not to work. This is my code: Code: Main.sd.MKDir("/logmetalim") Main.sd.MKDir("/logmetalim/segnala") I have read that the second mkdir could suffice, since the whole tree is created at once, differently from other enviromnents. I have also tried to call mkdir from inline code and got no result. But my code could be wrong...
Erel B4X founder Staff member Licensed User Longtime User Feb 8, 2018 #4 MKDir returns a boolean. Check its value. Try it with: Code: Log(Main.sd.MKDir("logmetalim")) 'without the slash (https://www.arduino.cc/en/Reference/SDmkdir) Upvote 0
MKDir returns a boolean. Check its value. Try it with: Code: Log(Main.sd.MKDir("logmetalim")) 'without the slash (https://www.arduino.cc/en/Reference/SDmkdir)
tigrot Well-Known Member Licensed User Longtime User Feb 8, 2018 #5 This is code fixed: Code: Log("mkdir:",Main.sd.MKDir("logmetalim")) Log("mkdir2:",Main.sd.MKDir("logmetalim/segnala")) This is log Code: mkdir:0 mkdir2:0 Let me check about FAT in SD, maybe it's an unsupported type? Upvote 0
This is code fixed: Code: Log("mkdir:",Main.sd.MKDir("logmetalim")) Log("mkdir2:",Main.sd.MKDir("logmetalim/segnala")) This is log Code: mkdir:0 mkdir2:0 Let me check about FAT in SD, maybe it's an unsupported type?
tigrot Well-Known Member Licensed User Longtime User Feb 8, 2018 #6 Checked, the SD is now FAT32 for sure. The files are created and appended. Directories are not created. Upvote 0
Checked, the SD is now FAT32 for sure. The files are created and appended. Directories are not created.
Erel B4X founder Staff member Licensed User Longtime User Feb 8, 2018 #7 The SD file system should be FAT. Preferably FAT16. I tested it here with FAT32 and it worked properly. Code: Log(sd.MKDir("test")) Log(sd.RMDIR("test")) Logs: 1 1 The folder was created. Upvote 0
The SD file system should be FAT. Preferably FAT16. I tested it here with FAT32 and it worked properly. Code: Log(sd.MKDir("test")) Log(sd.RMDIR("test")) Logs: 1 1 The folder was created.
tigrot Well-Known Member Licensed User Longtime User Feb 8, 2018 #8 I have prepared a simple one statement sketch, to test library. It does create the directory. Dunno why but in my app the statement is not executed correctly. Let me investigate my environment. Upvote 0
I have prepared a simple one statement sketch, to test library. It does create the directory. Dunno why but in my app the statement is not executed correctly. Let me investigate my environment.
tigrot Well-Known Member Licensed User Longtime User Feb 8, 2018 #9 I moved the directories' creation in AppStart. No way to create directories. In my test sketch everything is good. I upload my whole project for your reference. Thank you for help Attachments datalogger.zip datalogger.zip 13.6 KB · Views: 607 Upvote 0
I moved the directories' creation in AppStart. No way to create directories. In my test sketch everything is good. I upload my whole project for your reference. Thank you for help
Erel B4X founder Staff member Licensed User Longtime User Feb 8, 2018 #10 Probably a conflict with another library. See how the SD is enabled and disabled in this example: https://www.b4x.com/android/forum/threads/arduino-pc-file-transfer.67682/#content Upvote 0
Probably a conflict with another library. See how the SD is enabled and disabled in this example: https://www.b4x.com/android/forum/threads/arduino-pc-file-transfer.67682/#content
tigrot Well-Known Member Licensed User Longtime User Feb 8, 2018 #11 No conflict... I reintroduced the Windows names(10 bytes long) for directory. 8.3 is the max for Fat16/32. reducing the directory's name length to 8 is working. The strange that directory creation seems to work only at the very first beginning, but it's a wise solution, because it's were it should be. Thank you for support. Mauro Upvote 0
No conflict... I reintroduced the Windows names(10 bytes long) for directory. 8.3 is the max for Fat16/32. reducing the directory's name length to 8 is working. The strange that directory creation seems to work only at the very first beginning, but it's a wise solution, because it's were it should be. Thank you for support. Mauro