Main Site Documentation

Any quick code for accessing the uSD for Domino


#1

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


#2

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


#3

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?


#4

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


#5

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


#6

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…





#7

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!!!

#8

nice! Let us know how it goes


#9

Uploaded the testing project…

See this post:

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