NetduinoPlus SD Card Example

I was contacted the other day with a request for some help with code needed for use of the NetduinoPlus SD Card. So by way of response here we have a quick example, enjoy: [code lang="csharp"] using System; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.IO; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; namespace NetduinoSDOne { public class Program { public static void Main() { string[] fs = VolumeInfo.GetFileSystems(); VolumeInfo[] vols = VolumeInfo.GetVolumes(); int i = 0; Debug.Print("Volume Count: " + vols.Length.ToString()); foreach (VolumeInfo vi in vols) { Debug.Print("Root Directory: " + vi.RootDirectory.ToString()); Debug.Print("Total Volume: " + vi.TotalSize.ToString()); Debug.Print("Free Space: " + vi.TotalFreeSpace.ToString()); Debug.Print("Formatted: " + vi.IsFormatted.ToString()); Debug.Print("Volume ID: " + vi.VolumeID.ToString()); } OutputPort SdPower = new OutputPort((Cpu.Pin)25, false); // ensure that the SD card is powered InputPort sdDetected = new InputPort((Cpu.Pin)57, false, Port.ResistorMode.PullUp); Debug.Print("SD Detected: " + (!sdDetected.Read()).ToString()); sdDetected.Dispose(); while (true) { Debug.Print("n"); Debug.Print("Loop " + i.ToString()); Debug.Print("n"); string[] dirs = Directory.GetDirectories(@"SD"); foreach (string s in dirs) { Debug.Print(s); } switch (i) { case 0: #region Create Directory try { Directory.SetCurrentDirectory(@"SD"); Directory.CreateDirectory("Netduino"); } catch (Exception ex) { Debug.Print("Error: " + ex.Message.ToString()); } i = 1; #endregion Create Directory break; case 1: #region Delete Directory try { if (Directory.Exists("Netduino")) { Debug.Print("n"); Debug.Print("Netduino Directory Found"); Directory.Delete("Netduino"); } } catch (Exception ex) { Debug.Print("Error: " + ex.Message.ToString()); } i = 0; #endregion Delete Directory break; } Thread.Sleep(5000); } } } } [/code] ...more

Netduino Flex Sensor Example

Here we have another Netduino Sensor example. This time I am going to show you how to wire up a Spectra Symbol flex sensor as retailed by Sparkfun Electronics. About The Sensor As the sensor is flexed, the resistance across the sensor increases. Patented technology by Spectra Symbol - they claim these sensors were used in the original Nintendo Power Glove. The resistance of the flex sensor changes when the metal pads are on the outside of the bend (text on inside of bend). For more information on the Flex Sensor used, check out the following data sheet. ...more

Netduino Accelerometer Input Sample

The following is a simple example detailing how to interface of a Sparkfun ADXL 335 breakout board with a Netduino. Before you start, please ensure that your Netduino is running firmware patch 2 or above. Without this you will not be able to obtain multiple analog inputs. About the ADXL335 Breakout The ADXL335 is a triple axis accelerometer with extremely low noise and power consumption - only 320uA! The sensor has a full sensing range of +/-3g. More information regarding the ADXL335 can be located via the following data sheet. ...more

Netduino – Serial Communication

Update: check out  my netduino-serialporthelper-to-winform-and-xna post - based on code provided by hari over at the Netduino forums its a much better way to do it! The following details simple 2 way Communication with a Windows Forms App - Rudimentary packet handling has been implemented via inclusion of an additional byte to the beginning of the packet which details the length of the string to be sent to the Netduino. Once received the device filters the incoming data and recreates the string. A simple switch statement is then used to trigger functionality. To see it in action, check out the featured video. ...more

The Virtual Cane

Accessible interfaces have been created using the Nintendo Wii Remote (Wiimote) device, and other Wii technology. The Virtual Cane uses the Wiimote’s ability to describe a body within 3D space to provide an interface to 3D environments for the visually impaired. The Wii Cane System maps the real world position and orientation of a Wiimote to that of a virtual counterpart within a simulated 3D environment so that it can be used as a cane within the environment. Auditory, verbal and vibratory feedback are provided in various forms which can be used by people who are blind and visually impaired to navigate their way around virtual environments. ...more