Fez Raptor Memory Stick

Hello All,

First of all thank you for this wonderful community !
I have a USB host and a memory stick and a FEZ Raptor…
how can i connect and create files into the usb stick ?

i have seen many examples, but what is the difference between PersistantStorage, Removable Media ?

Can any one provide some examples on that ?

Many Thanks.

Welcome to the community and thank you for the comment!

For your specific usage, you will not need to use either one of those classes. With the USB host module, you will interface the module itself for device connected events etc.


string root;
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            usbHost.USBDriveConnected += usbHost_USBDriveConnected;
        }

        void usbHost_USBDriveConnected(UsbHost sender, GT.StorageDevice storageDevice)
        {
            root = storageDevice.RootDirectory;

            FileStream file = new FileStream(root + "\\file.txt", FileMode.OpenOrCreate);
        }

Worked ! Thank You James