Any quick code for accessing the uSD for Domino

Got some LCD shield code working now want to test out the SD…

Yes, it is in the free ebook! Have you looked? :wink:

Tried it…



Error 1 ‘GHIElectronics.NETMF.IO.PersistentStorage’ does not contain a definition for 'PersistentStorage_ID_SD"



Directory object doesn’t exist…



Basically a straight copy/paste…



MF 4.0?

Well I included some more assemblies (System.IO…thought it already was included)…that got the Directory class



MountFileSystem seems to succeed but VolumeInfo.GetVolumes returns empty array…



Still have to PersistentStorage sdPS = new PersistentStorage(“SD”); // Using string

aha! The book is not all updated for NETMF 4.0…we will update it once the new release is out (this week)

Take a look at example under persistent storage class in documentation http://ghielectronics.com/downloads/NETMF/Library%20Documentation/Index.html

Actually I’m looking at that now…



Tried this:

PersistentStorage sdPS = new PersistentStorage(“SD”);

sdPS.MountFileSystem();

string[] files = Directory.GetFiles(@ “\SD”)



Still nothing returned…



Maybe it’s the SD cards format…



VolumeInfo.GetFileSystems() returns a single item array "FAT"



SD card was probably formatted on my phone…seem to remember reading FAT32 is only supported format…





Reformatted the uSD to FAT32...VolumeInfo.GetFileSystems still returned single string "FAT"...
Got it working...here is the code

PersistentStorage luSD = new PersistentStorage("SD"); // Get the uSD
luSD.MountFileSystem(); // Mount the file system
// string[] lfs = VolumeInfo.GetFileSystems(); // Testing

VolumeInfo[] lVolumes = VolumeInfo.GetVolumes(); // Should get at least one volume
if (lVolumes.Length > 0)
{
string lRootDirectory = lVolumes[0].RootDirectory; // Assume SD is first volume

string[] lFiles = null;
lFiles = Directory.GetFiles(lRootDirectory); // Get list of files
}
luSD.UnmountFileSystem(); // Unmount uSD

Can now play with displaying files/directories on LCD shield...scrolling with the buttons...
Whew!!!

nice! Let us know how it goes

Uploaded the testing project…

See this post:

http://www.tinyclr.com/forum/7/53/