Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.SPOT;
- using System.Threading;
- using GT = Gadgeteer;
- using GTM = Gadgeteer.Modules;
- using Gadgeteer.Modules.GHIElectronics;
- namespace Gadgeteer_USB_Pen_01
- {
- public partial class Program
- {
- void ProgramStarted()
- {
- // Initialize event handling robots
- usbHost.USBDriveConnected += new GTM.GHIElectronics.UsbHost.USBDriveConnectedEventHandler(usb_USBDriveConnected);
- usbHost.USBDriveDisconnected += new GTM.GHIElectronics.UsbHost.USBDriveDisconnectedEventHandler(usb_USBDriveDisconnected);
- // create a button watching robot to trigger things when the button is pressed
- button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
- }
- void button_ButtonPressed(Button sender, Button.ButtonState state)
- {
- throw new NotImplementedException();
- }
- void usb_USBDriveDisconnected(GTM.GHIElectronics.UsbHost sender)
- {
- Debug.Print("\r\nThe USB thumb drive has been removed.");
- }
- void usb_USBDriveConnected(GTM.GHIElectronics.UsbHost sender, GT.StorageDevice storageDevice)
- {
- Debug.Print("\r\nUSB thumb drive has been inserted.");
- Debug.Print("Using storageDevice from the USBDriveConnected event, the root director is:");
- string[] root = storageDevice.ListRootDirectoryFiles();
- foreach (string fileName in root)
- {
- Debug.Print(" " + fileName);
- }
- Debug.Print("\r\nPlease remove the USB thumb drive to continue");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment