View on GitHub

Gadgeteer

Gadgeteer Programing

Download this project as a .zip file Download this project as a tar.gz file

Gadgeteer Examples

Gadgeteer is open-source hardware implementation using the .NET Micro Framework from GHI Electronics. GHI provides some excellent code snippets for many of their Gadgeteer modules. However, they don't provide any full working solutions. This project documents many of their modules with full working Visual Studio solution files.


2013/04/14 WiFi RS21 Example

Using the Wifi RS21 Module to host a server

This is the standard way to open and enable the wifi_RS21 interface.

if (!wifi_RS21.Interface.IsOpen)
{
	wifi_RS21.Interface.Open();
}
if (!wifi_RS21.Interface.NetworkInterface.IsDhcpEnabled)
{
	wifi_RS21.Interface.NetworkInterface.EnableDhcp();
}

You must subscribe the NetworkAddressChanged event to get IP address

wifi_RS21.Interface.NetworkAddressChanged += new NetworkInterfaceExtension.NetworkAddressChangedEventHandler(Interface_NetworkAddressChanged);

This method will catch the IP Address

void Interface_NetworkAddressChanged(object sender, EventArgs e)
{
	ipAddress = wifi_RS21.Interface.NetworkInterface.IPAddress;
}

Running the server is easy at this point.

public void RunServer()
{
	WebEvent GetValueEvent = WebServer.SetupWebEvent("GetValue");
	GetValueEvent.WebEventReceived += new WebEvent.ReceivedWebEventHandler(GetValueEvent_WebEventReceived);
	WebServer.StartLocalServer(ipAddress, 80);
}

The web event received can return any data you desire

void GetValueEvent_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
{
responder.Respond("testing");
}

Download the full WiFiRS21 code for a full example


Request for examples

Please contact me at wbsimms.com if you want a specific example published.