I am trying to use the built in wifi on the Cobra II. I am using the example code below. When I debug the code it stops on this line:
netif = new WiFiRS9110(SPI.SPI_module.SPI1, Cpu.Pin.GPIO_Pin1, Cpu.Pin.GPIO_Pin2, Cpu.Pin.GPIO_Pin3);
I uninstalled all of my .netmf, ghi and gadgeteer components, deleted the files and folders and installed the latest sdk. The error I get is exception in GHI.networking.dll. Any help is appreciated.
using GHI.Networking;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Net.NetworkInformation;
using System;
using System.Net;
using System.Threading;
public class Program
{
private static WiFiRS9110 netif;
public static void Main()
{
netif = new WiFiRS9110(SPI.SPI_module.SPI1, Cpu.Pin.GPIO_Pin1, Cpu.Pin.GPIO_Pin2, Cpu.Pin.GPIO_Pin3);
NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
netif.Open();
netif.EnableDhcp();
netif.EnableDynamicDns();
netif.Join("randyphone", "uncertainty");
while (netif.IPAddress == "0.0.0.0")
{
Debug.Print("Waiting for DHCP");
Thread.Sleep(250);
}
//The network is now ready to use.
}
private static void NetworkChange_NetworkAddressChanged(object sender, Microsoft.SPOT.EventArgs e)
{
Debug.Print("Network address changed");
}
private static void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
{
Debug.Print("Network availability: " + e.IsAvailable.ToString());
}
}