I am setting up a code to detect the presence of the Micro Sd with Netduino Plus.
using System; using System.Net; using System.IO; using System.Threading; using SecretLabs.NETMF.IO; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; using Microsoft.SPOT.Hardware; using Microsoft.SPOT.Net; using Microsoft.SPOT; public class SD_CARD1 { static InterruptPort SDPORTA = new InterruptPort((Cpu.Pin)57, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth); public static void Main() { OutputPort SD = new OutputPort((Cpu.Pin)25, false); InputPort SD_DETECTADO = new InputPort((Cpu.Pin)57, false, Port.ResistorMode.PullUp); Debug.Print("SD CARD DETECTADO!" + (SD_DETECTADO.Read().ToString())); SD_DETECTADO.Dispose(); SDPORTA.OnInterrupt += SDPORTA_OnInterrupt; } static void SDPORTA_OnInterrupt(uint data1, uint data2, DateTime data) { Debug.Print("SD CARD foi: " + ((!SDPORTA.Read()) ? "LOCALIZADO" : "REMOVIDO")); } }
By compiling the code OK! but when you start the application returns an error writing the Following:
"An unhandled exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll"
I do not know if there's anything wrong with the code!
but if something wrong can someone help me?